Start scaffolding web_canvas backend

This commit is contained in:
Mitchell Hashimoto
2022-11-30 15:05:09 -08:00
parent 6b101c2293
commit b858aea124
7 changed files with 117 additions and 35 deletions

View File

@@ -13,21 +13,24 @@
}
};
fetch('ghostty-term.wasm').then(response =>
fetch('ghostty-wasm.wasm').then(response =>
response.arrayBuffer()
).then(bytes =>
WebAssembly.instantiate(bytes, importObject)
).then(results => {
const {
terminal_new,
terminal_free,
terminal_print,
atlas_new,
atlas_free,
atlas_reserve,
free,
memory,
} = results.instance.exports;
const term = terminal_new(80, 80);
console.log(term);
terminal_free(term);
terminal_print('a');
const atlas = atlas_new(512, 0);
const reg = atlas_reserve(atlas, 10, 10);
console.log(reg);
free(reg);
atlas_free(atlas);
});
</script>
</body>