mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
37 lines
684 B
HTML
37 lines
684 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-wasm.wasm').then(response =>
|
|
response.arrayBuffer()
|
|
).then(bytes =>
|
|
WebAssembly.instantiate(bytes, importObject)
|
|
).then(results => {
|
|
const {
|
|
atlas_new,
|
|
atlas_free,
|
|
atlas_reserve,
|
|
free,
|
|
memory,
|
|
} = results.instance.exports;
|
|
|
|
const atlas = atlas_new(512, 0);
|
|
const reg = atlas_reserve(atlas, 10, 10);
|
|
free(reg);
|
|
atlas_free(atlas);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|