Add WASM bindings and web project structure

This commit is contained in:
Keavon Chambers
2021-02-15 03:21:49 -08:00
parent 618e62e5d4
commit cd6843a63f
13 changed files with 373 additions and 21 deletions
+17 -6
View File
@@ -1,7 +1,18 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
mod utils;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
}
#[wasm_bindgen]
pub fn greet() {
alert("Hello, Graphite!");
}