gossamer/custom_event

Types

An Event with a custom detail payload that can be dispatched from application code.

See CustomEvent on MDN.

pub type CustomEvent

The data carried by a CustomEvent. Inherited Event properties (type, bubbles, cancelable, etc.) are reachable via to_event and the functions in gossamer/event.

pub type Fields {
  Fields(detail: option.Option(dynamic.Dynamic))
}

Constructors

Values

pub fn detail(
  of event: CustomEvent,
) -> Result(dynamic.Dynamic, Nil)

Returns the detail value associated with the event, or an error if none was provided.

pub fn new(type_: String) -> CustomEvent

Creates a new CustomEvent with the given type.

pub fn new_with_detail(
  type_: String,
  detail detail: a,
) -> CustomEvent

Creates a new CustomEvent with the given type and detail value.

pub fn to_event(event: CustomEvent) -> event.Event

Converts a CustomEvent to a base Event for use with functions in gossamer/event.

pub fn to_fields(event: CustomEvent) -> Fields
Search Document