mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-09-22 15:21:58 +00:00
docs: add comments for the Handler
This commit is contained in:
parent
e47ead5347
commit
036a0ff49a
1 changed files with 2 additions and 0 deletions
|
@ -357,12 +357,14 @@ pub struct EventHandler<'bump, T = ()> {
|
|||
}
|
||||
|
||||
impl<T> EventHandler<'_, T> {
|
||||
/// Call this event handler with the appropriate event type
|
||||
pub fn call(&self, event: T) {
|
||||
if let Some(callback) = self.callback.borrow_mut().as_mut() {
|
||||
callback(event);
|
||||
}
|
||||
}
|
||||
|
||||
/// Forcibly drop the internal handler callback, releasing memory
|
||||
pub fn release(&self) {
|
||||
self.callback.replace(None);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue