Skip to content

@caido/quickjs-types / llrt/dom-events

llrt/dom-events

Classes

CustomEvent<D>

An event which takes place in the system.

Type Parameters

Type ParameterDefault type
Dany

Implements

Constructors

new CustomEvent()

new CustomEvent<D>(type: string, opts?: object): CustomEvent<D>

Parameters
ParameterType
typestring
opts?{ details: D; }
opts.details?D
Returns

CustomEvent<D>

Properties

details

readonly details: null | D

type

readonly type: string

Returns the type of event, e.g. "click", "hashchange", or "submit".

Implementation of

Event.type


EventTarget

EventTarget is an interface implemented by objects that can receive events and may have listeners for them.

Extended by

Constructors

new EventTarget()

new EventTarget(): EventTarget

Returns

EventTarget

Methods

addEventListener()

addEventListener(type: EventKey, listener: EventListener, options?: AddEventListenerOptions): void

Adds a new handler for the type event. Any given listener is added only once per type.

If the once option is true, the listener is removed after the next time a type event is dispatched.

Parameters
ParameterType
typeEventKey
listenerEventListener
options?AddEventListenerOptions
Returns

void

dispatchEvent()

dispatchEvent(event: Event): void

Dispatches a synthetic event event to target

Parameters
ParameterType
eventEvent
Returns

void

removeEventListener()

removeEventListener(type: EventKey, listener: EventListener): void

Removes the event listener in target's event listener list with the same type and callback

Parameters
ParameterType
typeEventKey
listenerEventListener
Returns

void

Interfaces

AddEventListenerOptions

Properties

once?

optional once: boolean

When true, the listener is automatically removed when it is first invoked. Default: false.


Event

An event which takes place in the system.

Properties

type

readonly type: EventKey

Returns the type of event, e.g. "click", "hashchange", or "submit".


EventListener()

EventListener(evt: Event): void

Parameters

ParameterType
evtEvent

Returns

void

Type Aliases

EventKey

EventKey: string | symbol