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


  1. wasm-bindgen - allows JS/wasm to communicate with strings, JS objects, classes, etc, as opposed to purely integers and floats.
    1. Ex. https://rustwasm.github.io/wasm-bindgen/print.html#srclibrs-1
  2. wasm-pack vite-plugin: https://github.com/nshen/vite-plugin-wasm-pack
  3. Getting { memory } module to load since now using the no bundler strategy. See link below (kudos!):
    1. https://lionturkey.github.io/posts/rustwasm/rustwasm.html
    2. "In order to access memory used by Wasm without npm, we need to save the output of the init() function"

Future TODOs:

  1. Implement Hashlife

Top categories

svelte logo

Want a Svelte site built?

Hire a Svelte developer
Loading Svelte Themes