use std::cell::RefCell; use std::rc::Rc; use yew::prelude::*; pub mod command_handler; pub mod lineengine; pub mod lua_state; pub mod parsing; pub mod split_panel; pub mod term_view; use crate::lua_state::{install_lua_globals, LuaState}; use crate::split_panel::*; use crate::term_view::*; #[derive(Properties)] pub struct GlobalState { // No strong references allowed between each of these groups of state. frame_registry: RefCell, lua_engine: RefCell, } type GlobalCell = Rc; // Used only for yew. Always equal since we don't want it to // actually look into GlobalState, changes there should never // cause a re-render. impl PartialEq for GlobalState { fn eq(&self, _other: &Self) -> bool { true } } #[function_component(App)] fn app() -> Html { let global = use_memo((), |_| GlobalState { frame_registry: RegisteredTermFrames::new().into(), lua_engine: LuaState::setup().expect("Can create interpreter").into(), }); install_lua_globals(&global).expect("Couldn't install Lua globals"); html! {
}} second={ html! { } }/>
} } fn main() { console_error_panic_hook::set_once(); yew::Renderer::::new().render(); }