aboutsummaryrefslogtreecommitdiff
path: root/src/zeroscript/App/main.js
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-12 09:43:19 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-12 09:43:19 +0200
commit0b2af471b6d5dfc4eaf53639102c1b854bbb324b (patch)
treeaba3943b8c54d26d8552d0685d4178bc995d91c3 /src/zeroscript/App/main.js
parent812f547d84b5ce1a2924ae16f6257e4fd19efcc0 (diff)
first version of zilch
Diffstat (limited to 'src/zeroscript/App/main.js')
-rw-r--r--src/zeroscript/App/main.js43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/zeroscript/App/main.js b/src/zeroscript/App/main.js
deleted file mode 100644
index 265c886..0000000
--- a/src/zeroscript/App/main.js
+++ /dev/null
@@ -1,43 +0,0 @@
-const imports = {
- object_store: {
- process: ObjectStore.processWasm,
- },
- console: {
- log(buffer, length) {
- console.log(ObjectStore.decodeString(buffer, length))
- },
- warn(buffer, length) {
- console.warn(ObjectStore.decodeString(buffer, length))
- },
- err(buffer, length) {
- console.error(ObjectStore.decodeString(buffer, length))
- },
- debug(buffer, length) {
- console.debug(ObjectStore.decodeString(buffer, length))
- },
- }
-}
-
-async function wasm_handle_event(target, name, event, pass_event) {
- await wasm_ready;
-
- const component = target.getRootNode().host;
-
- if (pass_event) {
- const id = ObjectStore.generateFreeId();
- ObjectStore.registerObject(id, event);
- wasm.exports[name](component[ZsPtr], id);
- ObjectStore.free(event);
- } else {
- wasm.exports[name](component[ZsPtr]);
- }
-}
-
-const wasm_ready = WebAssembly.instantiateStreaming(fetch("index.wasm"), imports).then(
- ({ instance, module }) => {
- wasm = {
- exports: instance.exports,
- memory: instance.exports.memory,
- }
- },
-);