rustwasm - Conway's Game of Life (w/SvelteKit)
Implementing the rustwasm tutorial of Conway's Game of Life using SvelteKit as the UI.
Development
- Using pnpm as package manager
- Node v20
Running
Install web dependencies:
pnpm install
Compile the wasm package via:
pnpm wasm
Run the development server:
pnpm dev
Visit: http://localhost:5173
Takeaways/Learnings/Links
- wasm-bindgen - allows JS/wasm to communicate with strings, JS objects, classes, etc, as opposed to purely integers and floats.
- Ex. https://rustwasm.github.io/wasm-bindgen/print.html#srclibrs-1
- wasm-pack vite-plugin: https://github.com/nshen/vite-plugin-wasm-pack
- Getting { memory } module to load since now using the
no bundler
strategy. See link below (kudos!):
- https://lionturkey.github.io/posts/rustwasm/rustwasm.html
- "In order to access memory used by Wasm without npm, we need to save the output of the init() function"
Future TODOs:
- Implement Hashlife