Fix undefined behavior in the editor wasm bridge (#414)

* removed possible undifined behavior

* changed naming of Editor -> JsEditorHandle

* fix rust formatting

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
mfish33 2021-12-20 17:55:31 -05:00 committed by Keavon Chambers
parent 6701437433
commit 53a1f19af0
3 changed files with 32 additions and 15 deletions

View file

@ -6,12 +6,16 @@ pub mod type_translators;
use editor::message_prelude::FrontendMessage;
use logging::WasmLog;
use std::cell::RefCell;
use std::collections::HashMap;
use std::panic;
use wasm_bindgen::prelude::*;
// Set up the persistent editor backend state
static LOGGER: WasmLog = WasmLog;
thread_local! { pub static EDITOR_HAS_CRASHED: RefCell<Option<FrontendMessage>> = RefCell::new(None); }
thread_local! {
pub static EDITOR_HAS_CRASHED: RefCell<Option<FrontendMessage>> = RefCell::new(None);
pub static EDITOR_INSTANCES: RefCell<HashMap<u64, editor::Editor>> = RefCell::new(HashMap::new());
}
// Initialize the backend
#[wasm_bindgen(start)]