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 1e57f658dc
commit 14f0bb489e
3 changed files with 32 additions and 15 deletions

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,