Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aidanaden/astro-zig-canvas
Minimal example for astro + HTML5 canvas + wasm memory + zig
https://github.com/aidanaden/astro-zig-canvas
Last synced: about 1 month ago
JSON representation
Minimal example for astro + HTML5 canvas + wasm memory + zig
- Host: GitHub
- URL: https://github.com/aidanaden/astro-zig-canvas
- Owner: aidanaden
- Created: 2024-07-17T00:48:56.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-03T17:26:14.000Z (5 months ago)
- Last Synced: 2024-08-03T18:38:19.391Z (5 months ago)
- Language: Astro
- Homepage: https://astro-zig-canvas.pages.dev/
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Build
The default (and only) target for this example is `wasm32-freestanding-musl`.
The latest zig version used to build this project is:
```shell
$ zig version
0.13.0
```To build the wasm module to `/public/bin/astro-checkerboard.wasm`, run:
```shell
$ zig build -p public$ ls ./public/bin
astro-checkerboard.wasm$ wc -c ./public/bin/astro-checkerboard.wasm
555 ./public/bin/astro-checkerboard.wasm
```Note: `build.zig` specifies various wasm-ld parameters. For example, it sets the initial memory size
and maximum size to be 2 pages, where each page consists of 64kB. Use the `--verbose` flag to see the complete list of flags the build uses.## Run
Run preview in this repo's directory:
```shell
pnpm run preview
```Go to your favorite browser and type to the URL `localhost:4321` (or whatever URL is stated from running the `preview` command.
You should see the checkboard changing colors.