From 9a4e8abe9d8456f1c2221285ec971bdb6745cfe6 Mon Sep 17 00:00:00 2001 From: Kim Dong-Hyun Date: Wed, 23 Oct 2024 22:57:56 +0900 Subject: [PATCH] Remove unneeded function call --- flutter_package/lib/src/interface_web.dart | 4 ++-- flutter_package/lib/src/load_web.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flutter_package/lib/src/interface_web.dart b/flutter_package/lib/src/interface_web.dart index e0771fff..98ba2108 100644 --- a/flutter_package/lib/src/interface_web.dart +++ b/flutter_package/lib/src/interface_web.dart @@ -15,9 +15,9 @@ void setCompiledLibPathReal(String path) { Future prepareInterfaceReal( AssignRustSignal assignRustSignal, ) async { - // Check and create the namespace JavaScript object. + // Check if the web app was already loaded. + // This step is important because Dart has hot restart. checkIfAlreadyLoaded(); - createRinfBindingsObject(); // Listen to Rust via JavaScript. rinfBindingsObject['send_rust_signal_extern'] = ( diff --git a/flutter_package/lib/src/load_web.dart b/flutter_package/lib/src/load_web.dart index 4bd48f0a..55b199b8 100644 --- a/flutter_package/lib/src/load_web.dart +++ b/flutter_package/lib/src/load_web.dart @@ -11,7 +11,7 @@ void setJsLibPath(String path) { } bool wasAlreadyLoaded = false; -js.JsObject rinfBindingsObject = createRinfBindingsObject(); +js.JsObject rinfBindingsObject = getRinfBindingsObject(); js.JsObject wasmBindingsObject = js.context['wasmBindings']; /// When Dart performs hot restart, @@ -24,7 +24,7 @@ void checkIfAlreadyLoaded() { /// Create the namespace JavaScript object. /// This namespace object is used by Rust /// to call functions defined in Dart. -js.JsObject createRinfBindingsObject() { +js.JsObject getRinfBindingsObject() { // Create a new `rinfBindings` JavaScript object if not present. // Otherwise, return the existing one. final js.JsObject jsObject;