Skip to content

Simple WebAssembly counter implemented in Rust. Use this project to learn the basics of WebAssembly and Rust integration.

License

Notifications You must be signed in to change notification settings

cvyl/wasm-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust WebAssembly Project pages-build-deployment

WebAssembly Counter Project

This project demonstrates a simple WebAssembly program written in Rust. The program implements a counter that can be incremented and decremented.

Prerequisites

Before you begin, ensure you have the following installed:

Building and Running

  1. Clone the repository:

    git clone https://github.com/ly-nld/wasm-counter.git
    cd wasm-counter
  2. Build the Rust project:

    cargo build --target wasm32-unknown-unknown
  3. Generate JavaScript bindings:

    wasm-bindgen target/wasm32-unknown-unknown/debug/wasm_counter.wasm --out-dir www --web
  4. Serve the project using a local server:

    # You can use http-server or any other server of your choice, for example, python -m http.server
    npx http-server www
  5. Open your browser and navigate to http://localhost:8080 (or the port used by your local server).

Usage

  • The webpage will display the current counter value.
  • Click the "Increment" button to increase the counter.
  • Click the "Decrement" button to decrease the counter.

License

This project is licensed under the MIT License.

About

Simple WebAssembly counter implemented in Rust. Use this project to learn the basics of WebAssembly and Rust integration.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project