mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Migrate bootstrapping in element embedding sample (#2315)
Migrating the Angular sample is blocked on https://github.com/flutter/flutter/issues/149443 Contributes to https://github.com/flutter/samples/issues/2297.
This commit is contained in:
@@ -162,7 +162,7 @@ h1 {
|
||||
}
|
||||
#flutter_target.resize {
|
||||
width: 480px;
|
||||
height: 320px;
|
||||
height: 336px;
|
||||
}
|
||||
#flutter_target.spin { animation: spin 6400ms ease-in-out infinite; }
|
||||
#flutter_target.shadow { position: relative; }
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
<title>Element embedding</title>
|
||||
<link rel="manifest" href="manifest.json" />
|
||||
|
||||
<!-- This script adds the flutter initialization JS code -->
|
||||
<script src="flutter.js" defer></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -81,17 +78,17 @@
|
||||
</section>
|
||||
|
||||
<script>
|
||||
window.addEventListener("load", function (ev) {
|
||||
// Embed flutter into div#flutter_target
|
||||
let target = document.querySelector("#flutter_target");
|
||||
_flutter.loader.loadEntrypoint({
|
||||
onEntrypointLoaded: async function (engineInitializer) {
|
||||
let appRunner = await engineInitializer.initializeEngine({
|
||||
hostElement: target,
|
||||
});
|
||||
await appRunner.runApp();
|
||||
},
|
||||
});
|
||||
{{flutter_js}}
|
||||
{{flutter_build_config}}
|
||||
|
||||
const target = document.getElementById('flutter_target');
|
||||
_flutter.loader.load({
|
||||
onEntrypointLoaded: async function (engineInitializer) {
|
||||
const appRunner = await engineInitializer.initializeEngine({
|
||||
hostElement: target,
|
||||
});
|
||||
await appRunner.runApp();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script src="js/demo-js-interop.js" defer></script>
|
||||
|
||||
Reference in New Issue
Block a user