Function dioxus_core::nodebuilder::on[][src]

pub fn on<'a, 'b>(
    bump: &'a Bump,
    event: &'static str,
    callback: impl Fn(VirtualEvent) + 'a
) -> Listener<'a>

Create an event listener.

event is the type of event to listen for, e.g. "click". The callback is the function that will be invoked when the event occurs.

Example

use dioxus::{builder::*, bumpalo::Bump};

let b = Bump::new();

let listener = on(&b, "click", |root, vdom, event| {
    // do something when a click happens...
});