Execute editor natively

This commit is contained in:
Adam
2025-07-25 11:01:21 -07:00
parent 4fec24893e
commit 0c60ebaabc
21 changed files with 296 additions and 29 deletions
+19
View File
@@ -27,6 +27,7 @@ thread_local! {
#[wasm_bindgen(start)]
pub fn init_graphite() {
// Set up the panic hook
#[cfg(not(feature = "native"))]
panic::set_hook(Box::new(panic_hook));
// Set up the logger with a default level of debug
@@ -105,6 +106,24 @@ extern "C" {
fn trace(msg: &str, format: &str);
}
#[wasm_bindgen]
extern "C" {
fn sendMessageToCefFromWasm(message: String);
}
#[wasm_bindgen]
pub fn send_message_to_cef(message: String) {
let global = js_sys::global();
// Get the function by name
let func = js_sys::Reflect::get(&global, &JsValue::from_str("sendMessageToCef")).expect("Function not found");
let func = func.dyn_into::<js_sys::Function>().expect("Not a function");
// Call it with argument
func.call1(&JsValue::NULL, &JsValue::from_str(&message)).expect("Function call failed");
}
#[derive(Default)]
pub struct WasmLog;