31 lines
922 B
JavaScript
31 lines
922 B
JavaScript
|
window.addEventListener("load", async () => {
|
||
|
try {
|
||
|
await Scheme.load_main("scene.wasm", {
|
||
|
user_imports: {
|
||
|
document: {
|
||
|
getElementById(id) {
|
||
|
return document.getElementById(id);
|
||
|
}
|
||
|
},
|
||
|
element: {
|
||
|
innerText(elem) {
|
||
|
return elem.innerText;
|
||
|
},
|
||
|
setInnerText(elem, value) {
|
||
|
elem.innerText = value;
|
||
|
},
|
||
|
addEventListener(elem, event, listener) {
|
||
|
elem.addEventListener(event, listener);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
} catch (e) {
|
||
|
if (e instanceof WebAssembly.CompileError) {
|
||
|
document.getElementById("wasm-error").hidden = false;
|
||
|
}
|
||
|
|
||
|
throw e;
|
||
|
}
|
||
|
});
|