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 GitHub
co-authored by Keavon Chambers
parent cc0a733f46
commit 96a211f9fd
3 changed files with 32 additions and 15 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ import { createJsDispatcher } from "@/dispatcher/js-dispatcher";
import { JsMessageType } from "@/dispatcher/js-messages";
export type WasmInstance = typeof import("@/../wasm/pkg");
export type RustEditorInstance = InstanceType<WasmInstance["Editor"]>;
export type RustEditorInstance = InstanceType<WasmInstance["JsEditorHandle"]>;
let wasmImport: WasmInstance | null = null;
export async function initWasm() {
@@ -65,7 +65,7 @@ export function createEditorState() {
dispatcher.handleJsMessage(messageType, data, rawWasm, instance);
};
const instance = new rawWasm.Editor(rustCallback);
const instance = new rawWasm.JsEditorHandle(rustCallback);
return {
dispatcher,