Add ability to 'restart' test

This commit is contained in:
Yash Karandikar 2021-11-23 13:14:16 -06:00
parent 69e3929051
commit 50f53e747d
Signed by: karx
GPG key ID: A794DA2529474BA5
2 changed files with 9 additions and 3 deletions

View file

@ -1,7 +1,7 @@
mod interval;
use crate::interval::{set_interval, clear_interval};
use sycamore::prelude::*;
use crate::interval::{clear_interval, set_interval};
use sycamore::{prelude::*, rt::Event};
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
@ -10,6 +10,8 @@ extern "C" {
fn process_text(value: String) -> usize;
#[wasm_bindgen]
fn reset();
#[wasm_bindgen]
fn reload(event: Event);
}
fn main() {
@ -140,7 +142,7 @@ fn main() {
div(class="text-align-center") {
"Great job!"
br
button { "Click to restart" }
button(on:click=reload) { "Click to restart" }
}
}
})

View file

@ -32,4 +32,8 @@ function reset() {
char.classList.remove('correct');
char.classList.remove('incorrect');
})
}
function reload(event) {
window.location.reload();
}