15 lines
448 B
JavaScript
15 lines
448 B
JavaScript
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;
|
|
}
|
|
});
|
|
});
|