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

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

#1672 in Web programming

41 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