#web-api #emscripten #dom #js #platform #build #build-web

bin+lib webplatform

APIs for the web platform for cross-compiled Rust to JS

11 releases

Uses old Rust 2015

0.4.2 Oct 15, 2016
0.4.1 Oct 13, 2016
0.3.0 Sep 21, 2015
0.2.0 Sep 20, 2015
0.0.1 Sep 12, 2015

#14 in #emscripten

Download history 15/week @ 2024-11-27 43/week @ 2024-12-04 31/week @ 2024-12-11 4/week @ 2024-12-18 2/week @ 2025-01-08 12/week @ 2025-01-15 4/week @ 2025-01-22 26/week @ 2025-02-05 35/week @ 2025-02-12 13/week @ 2025-02-26

74 downloads per month

MIT license

2.5MB
64K SLoC

JavaScript 64K SLoC // 0.0% comments Rust 480 SLoC

rust-webplatform

A Rust library for use with emscripten to access the DOM.

Read the documentation, read brson's post on how Rust works with emscripten, or see an example app with rust-todomvc.

extern crate webplatform;

use webplatform::HtmlNode;

let body = HtmlNode::query("body").unwrap();
body.html_set("<h1>HELLO FROM RUST</h1> <button>CLICK ME</button>");
let mut button = HtmlNode::query("button").unwrap();
button.on("click", || alert("WITNESS ME"));

Used with cargo build --target=asmjs-unknown-emscripten.

License

MIT or Apache-2.0, at your option.

Dependencies