Skip to content

Commit

Permalink
Revert changes in JS module load
Browse files Browse the repository at this point in the history
  • Loading branch information
temeddix committed Oct 23, 2024
1 parent 01d6a83 commit 3d0fb6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
9 changes: 0 additions & 9 deletions flutter_package/lib/src/interface_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> prepareInterfaceReal(
AssignRustSignal assignRustSignal,
) async {
if (wasAlreadyLoaded) {
return;
}

final jsObject = js.JsObject.jsify({});
js.context['rinfBindings'] = jsObject;

Expand Down
9 changes: 9 additions & 0 deletions flutter_package/lib/src/load_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> loadJsFile() async {
if (wasAlreadyLoaded) {
return;
}

final loadCompleter = Completer<void>();
js.context['completeRinfLoad'] = loadCompleter.complete;

Expand Down

0 comments on commit 3d0fb6b

Please sign in to comment.