gossamer/event

Types

pub type Event
pub type EventInit {
  Bubbles(Bool)
  Cancelable(Bool)
  Composed(Bool)
}

Constructors

  • Bubbles(Bool)
  • Cancelable(Bool)
  • Composed(Bool)

Values

pub fn composed_path(of event: Event) -> List(dynamic.Dynamic)

Returns the event’s path, which is a list of event targets through which the event will pass.

pub fn current_target(
  of event: Event,
) -> Result(dynamic.Dynamic, Nil)

Returns the event target whose event listener is currently being invoked, or an error if none.

pub fn event_phase(of event: Event) -> event_phase.EventPhase

Returns the current phase of the event flow.

pub fn is_bubbles(of event: Event) -> Bool

Returns whether the event bubbles up through the DOM tree.

pub fn is_cancelable(of event: Event) -> Bool

Returns whether the event can be cancelled.

pub fn is_composed(of event: Event) -> Bool

Returns whether the event is composed and will propagate across shadow DOM boundaries.

pub fn is_default_prevented(of event: Event) -> Bool

Returns whether prevent_default has been called on the event.

pub fn is_trusted(of event: Event) -> Bool

Returns whether the event was dispatched by the user agent rather than by script.

pub fn new(type_: String) -> Event

Creates a new Event with the given type.

pub fn new_with(
  type_: String,
  with init: List(EventInit),
) -> Event

Creates a new Event with the given type and initialization options.

pub fn prevent_default(event: Event) -> Event

Cancels the event if it is cancelable, preventing the default action that belongs to the event from occurring.

pub fn stop_immediate_propagation(event: Event) -> Event

Prevents all other event listeners from being called, including those on the same target.

pub fn stop_propagation(event: Event) -> Event

Prevents further propagation of the current event in the capturing and bubbling phases.

pub fn target(of event: Event) -> Result(dynamic.Dynamic, Nil)

Returns the event target that dispatched the event, or an error if the event has not been dispatched.

pub fn time_stamp(of event: Event) -> Float

Returns the time at which the event was created, in milliseconds since the time origin.

pub fn type_(of event: Event) -> String

Returns the type of the event (e.g., “click”, “load”).

Search Document