EN605.607.81.SP22_ASDM_Project/front_end/src/main.rs
Stephen Seo 839e9021fa Refactor: Replace calling JS settimeout with Rust
web-sys and js-sys provides ways to use "settimeout" in pure Rust which
is used instead of calling into Javascript to do "settimeout".
2022-03-23 16:56:25 +09:00

30 lines
587 B
Rust

mod ai;
mod constants;
mod game_logic;
mod html_helper;
mod random_helper;
mod state;
mod yew_components;
use state::SharedState;
use yew::prelude::*;
use yew_components::Wrapper;
#[function_component(App)]
pub fn app() -> Html {
let ctx = use_state(SharedState::default);
html! {
<ContextProvider<SharedState> context={(*ctx).clone()}>
<Wrapper />
</ContextProvider<SharedState>>
}
}
fn main() {
// setup logging to browser console
wasm_logger::init(wasm_logger::Config::default());
// start webapp
yew::start_app::<App>();
}