20 lines
662 B
JavaScript
20 lines
662 B
JavaScript
async function load() {
|
|
const [message] = await Scheme.load_main("hello.wasm", {}, {
|
|
js: {
|
|
alert: alert,
|
|
prompt: prompt,
|
|
},
|
|
document: {
|
|
body() { return document.body; },
|
|
createTextNode: Document.prototype.createTextNode.bind(document),
|
|
createElement: Document.prototype.createElement.bind(document),
|
|
},
|
|
element: {
|
|
appendChild(parent, child) { return parent.appendChild(child); },
|
|
setAttribute(elem, name, value) { elem.setAttribute(name, value); },
|
|
}
|
|
});
|
|
console.log(message);
|
|
}
|
|
window.addEventListener("load", load);
|