create node watcher API
This commit is contained in:
1 parent
93f64d91c9
commit
bd07d7754c
9 files changed
+294
-339
No files matched your search
@@ -0,0 +1,15 @@
|
||||
use crate::{node::FromAnyValue, NodeMut};
|
||||
|
||||
/// A trait for watching for changes in the DOM tree.
|
||||
pub trait NodeWatcher<V: FromAnyValue + Send + Sync> {
|
||||
/// Called after a node is added to the tree.
|
||||
fn on_node_added(&self, _node: NodeMut<V>) {}
|
||||
/// Called before a node is removed from the tree.
|
||||
fn on_node_removed(&self, _node: NodeMut<V>) {}
|
||||
/// Called after a node is moved to a new parent.
|
||||
fn on_node_moved(&self, _node: NodeMut<V>) {}
|
||||
// /// Called after the text content of a node is changed.
|
||||
// fn on_text_changed(&self, _node: NodeMut<V>) {}
|
||||
// /// Called after an attribute of an element is changed.
|
||||
// fn on_attribute_changed(&self, _node: NodeMut<V>, attribute: &str) {}
|
||||
}
|
||||
Reference in new issue
Block a user