Skip to main content

handle_events_using_callbacks

Macro handle_events_using_callbacks 

Source
macro_rules! handle_events_using_callbacks {
    () => { ... };
}
Expand description

Generates an __afia__$handle_event function that expects that a pointer to a Callback was used as the context when calling [crate::DomElement::add_event_listener]’s context.

The generated functions behaves similar to the following:

use afia_component::callback::Callback;
use afia_component::dom::event::DomEvent;

#[export_name = "__afia__$handle_event"]
pub extern "C" fn handle_event(event: DomEvent, callback: &'static Callback) {
    callback.call(event);
}