guile-scene/scene.js

31 lines
922 B
JavaScript
Raw Normal View History

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;
}
});