gossamer/event_target
Types
pub type EventTarget
Values
pub fn add_event_listener(
to target: EventTarget,
on type_: String,
run listener: fn(event.Event) -> a,
) -> Nil
Registers an event listener on the target for the given event type.
pub fn add_event_listener_with(
to target: EventTarget,
on type_: String,
run listener: fn(event.Event) -> a,
with options: List(listener_option.ListenerOption),
) -> Nil
Registers an event listener on the target with additional options such as
Once, Capture, Passive, or Signal.
pub fn dispatch_event(
on target: EventTarget,
event event: event.Event,
) -> Bool
Dispatches an event to the target, invoking any registered listeners.
Returns whether prevent_default was not called by any listener.
pub fn remove_event_listener(
from target: EventTarget,
on type_: String,
listener listener: fn(event.Event) -> a,
) -> Nil
Removes a previously registered event listener from the target. The
listener must be the same function reference that was passed to
add_event_listener.
pub fn remove_event_listener_with(
from target: EventTarget,
on type_: String,
listener listener: fn(event.Event) -> a,
with options: List(listener_option.ListenerOption),
) -> Nil
Removes a previously registered event listener with the matching options.