Skip to main content
Events - Web documentation

Functions

f
addEventListener
Registers an event listener in the global scope, which will be called synchronously whenever the event `type` is dispatched. ```ts addEventListener('unload', () => { console.log('All finished!'); }); ... dispatchEvent(new Event('unload')); ```
f
dispatchEvent
Dispatches an event in the global scope, synchronously invoking any registered event listeners for this event in the appropriate order. Returns false if event is cancelable and at least one of the event handlers which handled this event called Event.preventDefault(). Otherwise it returns true. ```ts dispatchEvent(new Event('unload')); ```
f
removeEventListener
Remove a previously registered event listener from the global scope ```ts const listener = () => { console.log('hello'); }; addEventListener('load', listener); removeEventListener('load', listener); ```

Interfaces

Type Aliases

Variables

v
onbeforeunload
No documentation available
v
onerror
No documentation available
v
onload
No documentation available
v
onunhandledrejection
No documentation available
v
onunload
No documentation available