mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-01-20 11:50:41 +00:00
hook up logging to wasm, example uses new zig-js package
This commit is contained in:
@@ -1,36 +1,11 @@
|
||||
<!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>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Ghostty Example</title>
|
||||
<script type="module" src="app.ts"></script>
|
||||
</head>
|
||||
<body>
|
||||
Open your console, we are just debugging here.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user