diff --git a/flutter_package/lib/src/interface_web.dart b/flutter_package/lib/src/interface_web.dart index 12eeaaed..4a48eff2 100644 --- a/flutter_package/lib/src/interface_web.dart +++ b/flutter_package/lib/src/interface_web.dart @@ -13,18 +13,9 @@ void setCompiledLibPathReal(String path) { setJsLibPath(path); } -// When Dart performs hot restart, -// the `rinfBindings` object is already defined -// as a global JavaScript variable. -final wasAlreadyLoaded = js.context.hasProperty('rinfBindings'); - Future prepareInterfaceReal( AssignRustSignal assignRustSignal, ) async { - if (wasAlreadyLoaded) { - return; - } - final jsObject = js.JsObject.jsify({}); js.context['rinfBindings'] = jsObject; diff --git a/flutter_package/lib/src/load_web.dart b/flutter_package/lib/src/load_web.dart index 0d109f70..391da79a 100644 --- a/flutter_package/lib/src/load_web.dart +++ b/flutter_package/lib/src/load_web.dart @@ -10,7 +10,16 @@ void setJsLibPath(String path) { jsLibPath = path; } +// When Dart performs hot restart, +// the `rinfBindings` object is already defined +// as a global JavaScript variable. +final wasAlreadyLoaded = js.context.hasProperty('rinfBindings'); + Future loadJsFile() async { + if (wasAlreadyLoaded) { + return; + } + final loadCompleter = Completer(); js.context['completeRinfLoad'] = loadCompleter.complete;