30 releases

0.2.12 Jan 1, 2023
0.2.10 Dec 28, 2022
0.1.16 Jul 17, 2022
0.1.15 May 13, 2021
0.0.2 Nov 21, 2014

#3 in #build-web

Download history 1/week @ 2024-01-10 12/week @ 2024-01-17 5/week @ 2024-02-14 21/week @ 2024-02-21 17/week @ 2024-02-28 20/week @ 2024-03-06 14/week @ 2024-03-13 16/week @ 2024-03-20 7/week @ 2024-03-27

58 downloads per month
Used in 2 crates

MIT/Apache

110KB
3K SLoC

web-rs

docs.rs docs

A Rust library full of useful functions from various microlibraries for interacting with the web browser using js-wasm.

[dependencies]
web = "0.1"
use web::*;

#[no_mangle]
pub fn main() {
    set_interval(|| {
            log(&format!("{}", random()));
        }, 1000);
}
<html>
    <head>
        <script src="https://unpkg.com/js-wasm/js-wasm.js"></script>
        <script type="application/wasm" src="helloworld.wasm"></script>
    </head>
    <body>
        ...
    </body>
</html>
# cli commands for building web assembly
build:
	@RUSTFLAGS='-C link-arg=-s' cargo build --target wasm32-unknown-unknown --release
	@cp target/wasm32-unknown-unknown/release/helloworld.wasm .
lint:
	@cargo fmt
serve:
	python3 -m http.server 8080
  • console, errors, timing
  • timers, render loops, intervals
  • random numbers
  • DOM
  • canvas
  • webgl

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in web by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.5MB
~36K SLoC