2022-11-09 03:39:37 +00:00
|
|
|
use crate::{nodes::VNode, scopes::ScopeId, virtual_dom::VirtualDom, DynamicNode};
|
2022-11-02 01:42:29 +00:00
|
|
|
|
|
|
|
impl VirtualDom {
|
|
|
|
pub fn drop_scope(&mut self, id: ScopeId) {
|
|
|
|
let scope = self.scopes.get(id.0).unwrap();
|
|
|
|
|
|
|
|
let root = scope.root_node();
|
|
|
|
let root = unsafe { std::mem::transmute(root) };
|
|
|
|
|
|
|
|
self.drop_template(root);
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn drop_template<'a>(&'a mut self, template: &'a VNode<'a>) {
|
|
|
|
for node in template.dynamic_nodes.iter() {
|
2022-11-03 08:24:20 +00:00
|
|
|
match node {
|
|
|
|
DynamicNode::Text { id, .. } => {}
|
2022-11-02 01:42:29 +00:00
|
|
|
|
2022-11-03 08:24:20 +00:00
|
|
|
DynamicNode::Component { .. } => {
|
2022-11-02 01:42:29 +00:00
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
2022-11-04 00:34:42 +00:00
|
|
|
DynamicNode::Fragment(children) => {}
|
|
|
|
DynamicNode::Placeholder(_) => todo!(),
|
2022-11-02 01:42:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|