diff options
Diffstat (limited to 'example')
| -rw-r--r-- | example/index.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/example/index.html b/example/index.html new file mode 100644 index 000000000..f93da37d7 --- /dev/null +++ b/example/index.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>WASM Example</title> + </head> + <body> + <script> + const importObject = { + module: {}, + env: { + // memory: new WebAssembly.Memory({ initial: 256 }), + } + }; + + fetch('ghostty-term.wasm').then(response => + response.arrayBuffer() + ).then(bytes => + WebAssembly.instantiate(bytes, importObject) + ).then(results => { + const { + terminal_new, + terminal_free, + terminal_print, + } = results.instance.exports; + + const term = terminal_new(80, 80); + console.log(term); + terminal_free(term); + terminal_print('a'); + }); + </script> + </body> +</html> |
