ghostty/example/index.html
2022-08-17 13:57:21 -07:00

35 lines
658 B
HTML

<!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>