#emscripten #web-api #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

#1776 in Web programming

Download history 8/week @ 2024-02-19 23/week @ 2024-02-26 10/week @ 2024-03-04 39/week @ 2024-03-11 9/week @ 2024-03-18 48/week @ 2024-04-01 4/week @ 2024-04-15 13/week @ 2024-04-22

65 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