rust-webplatform / rust-webplatform

Rust library for Emscripten-compiled JS apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rust-webplatform

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

NOTE: This project is no longer actively developed. See stdweb for an actively-developed project for using Rust in asmjs / wasm.

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

extern crate webplatform;

fn main() {
    let document = webplatform::init();
    let body = document.element_query("body").unwrap();
    body.html_set("<h1>HELLO FROM RUST</h1> <button>CLICK ME</button>");
    let button = document.element_query("button").unwrap();
    button.on("click", |_| webplatform::alert("WITNESS ME"));
}

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

License

MIT or Apache-2.0, at your option.

About

Rust library for Emscripten-compiled JS apps.


Languages

Language:JavaScript 99.0%Language:Rust 0.6%Language:CSS 0.3%Language:HTML 0.2%