Desktop: Buffer web messages until connection is initialized (#3082)

Buffer web messages until connection is initialized
This commit is contained in:
Timon
2025-08-22 15:15:17 +00:00
committed by GitHub
parent a4ec50d8ba
commit c6ec3a27ca
9 changed files with 74 additions and 14 deletions
+3
View File
@@ -242,6 +242,9 @@ impl EditorHandle {
#[wasm_bindgen(js_name = initAfterFrontendReady)]
pub fn init_after_frontend_ready(&self, platform: String) {
#[cfg(feature = "native")]
crate::native_communcation::initialize_native_communication();
// Send initialization messages
let platform = match platform.as_str() {
"Windows" => Platform::Windows,
+11
View File
@@ -20,6 +20,17 @@ pub fn receive_native_message(buffer: ArrayBuffer) {
}
}
pub fn initialize_native_communication() {
let global = js_sys::global();
// Get the function by name
let func = js_sys::Reflect::get(&global, &JsValue::from_str("initializeNativeCommunication")).expect("Function not found");
let func = func.dyn_into::<js_sys::Function>().expect("Not a function");
// Call it
func.call0(&JsValue::NULL).expect("Function call failed");
}
pub fn send_message_to_cef(message: String) {
let global = js_sys::global();