hello.js 550 B

1234567891011121314151617181920
  1. window.addEventListener("load", async () => {
  2. try {
  3. await Scheme.load_main("hello.wasm", {
  4. reflect_wasm_dir: ".",
  5. user_imports: {
  6. document: {
  7. body() { return document.body; },
  8. createTextNode: Document.prototype.createTextNode.bind(document)
  9. },
  10. element: {
  11. appendChild(parent, child) { return parent.appendChild(child); }
  12. }
  13. }});
  14. } catch(e) {
  15. if(e instanceof WebAssembly.CompileError) {
  16. document.getElementById("wasm-error").hidden = false;
  17. }
  18. }
  19. });