Add wasm-beep example

This commit is contained in:
Tatsuyuki Ishi 2020-03-01 10:59:48 +09:00 • committed by mitchmindtree
parent cf4e6ca5bf
commit 9dc0c04c95
10 changed files with 6938 additions and 0 deletions

View file

@ -0,0 +1,14 @@
import("./pkg").catch(console.error).then(rust_module=>{
let handle = null;
const play_button = document.getElementById("play");
play_button.addEventListener("click", event => {
handle = rust_module.beep();
});
const stop_button = document.getElementById("stop");
stop_button.addEventListener("click", event => {
if (handle != null) {
handle.free();
handle = null;
}
});
});