Stephen Seo
ebf0cb5bb8
This commit is also a stepping-stone towards handling http requests which will require deferred callbacks on Yew Components. By figuring out how to delay callbacks in this commit, it should be easier to figure out how to handle http requests that may require a deferred callback.
31 lines
608 B
Rust
31 lines
608 B
Rust
mod ai;
|
|
mod async_js_helper;
|
|
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>();
|
|
}
|