1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#![no_std] extern crate alloc; use alloc::string::String; use alloc::string::ToString; use alloc::vec::Vec; use js_ffi::*; #[derive(Default)] pub struct Text { content: String } impl Text { pub fn new(t:&str) -> Self{ Text { content:t.to_string() } } pub fn construct(&self,_children:Option<Vec<View>>){ } } pub struct Wui { fn_logger:JSValue } pub enum View { Text(Text) } impl Default for Wui { fn default() -> Self { Wui{ fn_logger:register("console.log") } } } impl Wui { pub fn render(&self, v:View){ call_1(UNDEFINED, self.fn_logger, TYPE_STRING, to_js_string("Hello World")); } } pub use view::view;