Events API
chevron down
 

Events API

Class: Event

Base type of event objects.

Properties

readonly defaultPrevented

boolean

Set to true when the default handling was prevented

readonly target

EventTarget or undefined

Target of the event

readonly type

string

Type of the event

Methods

preventDefault()

Returns: void

Prevent the default handling of this event

stopImmediatePropagation()

Returns: void

Stop the propagation of the event immediately

stopPropagation()

Returns: void

Stop the propagation of the event

Interface: EventInit

Implemented by websocket.MessageEventInit

Interface: EventListener

The EventListener interface is the primary method for handling events.

Interface: EventTarget

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

Implemented by companion.Companion, file-transfer.Inbox, file-transfer.FileTransfer, life-cycle.Companion, location-change.Companion, peer.PeerApp, wake-interval.Companion, appbit.Appbit, clock.Clock, document.GlobalEvents, exercise.Exercise, file-transfer.Inbox, file-transfer.FileTransfer, power.Battery, power.Charger, system.MemoryPressureMonitor, sensors.Sensor

Methods

addEventListener()

addEventListener(type: string, listener: EventListener)

Returns: void

This method adds the specified listener object to the list of event listeners (for the specified event type) on the EventTarget on which it's called.

dispatchEvent()

dispatchEvent(event: Event)

Returns: boolean

Dispatches an Event at the specified EventTarget, invoking the affected EventListener in the appropriate order.

removeEventListener()

removeEventListener(type: string, listener: EventListener)

Returns: void

This method removes from the EventTarget an event listener previously registered with addEventListener.