This commit is contained in:
Dan Field
2020-01-27 14:36:02 -08:00
committed by GitHub
parent 31cd3c7b80
commit 8b2993337a
196 changed files with 1605 additions and 1682 deletions

View File

@@ -55,7 +55,8 @@ window.\$hotReloadHook = function(modules) {
// once we've reloaded every module, trigger the hot reload.
if (reloadCount == modules.length) {
require(["$entrypoint", "dart_sdk"], function(app, dart_sdk) {
window.\$mainEntrypoint = app.main.main;
// See L81 below for an explanation.
window.\$mainEntrypoint = app[Object.keys(app)[0]].main;
window.\$hotReload(resolve);
});
}
@@ -78,22 +79,23 @@ define("main_module", ["$entrypoint", "dart_sdk"], function(app, dart_sdk) {
let voidToNull = () => (voidToNull = dart_sdk.dart.constFn(dart_sdk.dart.fnType(dart_sdk.core.Null, [dart_sdk.dart.void])))();
// Attach the main entrypoint and hot reload functionality to the window.
window.\$mainEntrypoint = app.main.main;
// The app module will have a single property which contains the actual application
// code. The property name is based off of the entrypoint that is generated, for example
// the file `foo/bar/baz.dart` will generate a property named approximately
// `foo__bar__baz`. Rather than attempt to guess, we assume the first property of
// this object is the module.
window.\$mainEntrypoint = app[Object.keys(app)[0]].main;
if (window.\$hotReload == null) {
window.\$hotReload = function(cb) {
dart_sdk.developer.invokeExtension("ext.flutter.disassemble", "{}").then((_) => {
dart_sdk.dart.hotRestart();
dart_sdk.ui.webOnlyInitializePlatform().then(dart_sdk.core.Null, dart_sdk.dart.fn(_ => {
window.\$mainEntrypoint();
window.requestAnimationFrame(cb);
}, voidToNull()));
window.\$mainEntrypoint();
window.requestAnimationFrame(cb);
});
}
}
dart_sdk.ui.webOnlyInitializePlatform().then(dart_sdk.core.Null, dart_sdk.dart.fn(_ => {
app.main.main();
}, voidToNull()));
window.\$mainEntrypoint();
});
// Require JS configuration.