Feat: move webview logic into library
This commit is contained in:
1 parent
18a7a1f9c4
commit
32b45e5ba1
10 files changed
+249
-514
No files matched your search
@@ -79,7 +79,6 @@ impl<'a> Context<'a> {
|
||||
let safe_nodes = lazy_nodes(self.bump);
|
||||
let unsafe_nodes = unsafe { std::mem::transmute::<VNode<'a>, VNode<'static>>(safe_nodes) };
|
||||
self.final_nodes.deref().borrow_mut().replace(unsafe_nodes);
|
||||
info!("lazy nodes have been generated");
|
||||
DomTree {}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub struct Scope {
|
||||
pub frames: ActiveFrame,
|
||||
|
||||
// IE Which listeners need to be woken up?
|
||||
pub listeners: Vec<Box<dyn Fn()>>,
|
||||
pub listeners: Vec<Box<dyn Fn(crate::events::VirtualEvent)>>,
|
||||
|
||||
// lying, cheating reference >:(
|
||||
pub props: Box<dyn std::any::Any>,
|
||||
@@ -55,7 +55,7 @@ impl Scope {
|
||||
// Capture the caller
|
||||
let caller = f as *const ();
|
||||
|
||||
let listeners: Vec<Box<dyn Fn()>> = vec![Box::new(|| {
|
||||
let listeners: Vec<Box<dyn Fn(crate::events::VirtualEvent)>> = vec![Box::new(|_| {
|
||||
log::info!("Base listener called");
|
||||
})];
|
||||
|
||||
|
||||
@@ -98,12 +98,7 @@ impl VirtualDom {
|
||||
|
||||
component.run::<()>();
|
||||
|
||||
let old = component.old_frame();
|
||||
let new = component.new_frame();
|
||||
dbg!(old);
|
||||
dbg!(new);
|
||||
|
||||
diff_machine.diff_node(old, new);
|
||||
diff_machine.diff_node(component.old_frame(), component.new_frame());
|
||||
|
||||
Ok(diff_machine.consume())
|
||||
}
|
||||
@@ -136,7 +131,7 @@ impl VirtualDom {
|
||||
let EventTrigger {
|
||||
component_id,
|
||||
listener_id,
|
||||
event: _,
|
||||
event: source,
|
||||
} = event;
|
||||
|
||||
let component = self
|
||||
@@ -151,7 +146,7 @@ impl VirtualDom {
|
||||
.as_ref();
|
||||
|
||||
// Run the callback with the user event
|
||||
listener();
|
||||
listener(source);
|
||||
|
||||
// Mark dirty components. Descend from the highest node until all dirty nodes are updated.
|
||||
let mut affected_components = Vec::new();
|
||||
|
||||
Reference in new issue
Block a user