Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tachys/src/html/element/element_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ pub trait ElementExt {
S: IntoStyle;

/// Adds an event listener to the element, at runtime.
///
/// Dropping the returned handle also drops the closure and invalidates the event listener.
/// Consider using [on_cleanup](reactive_graph::owner::Owner::on_cleanup) to delay dropping:
///
/// ```rust,ignore
/// let remove = element.on(ev::blur, move |_| /* ... */);
/// on_cleanup(move || std::mem::drop(remove));
/// ```
fn on<E>(
&self,
ev: E,
Expand Down
Loading