function addEventListener
Jump to headingaddEventListener<K extends keyof WindowEventMap>(type: K,listener: (this: Window,ev: WindowEventMap[K],) => any,options?: boolean | AddEventListenerOptions,): void
Registers an event listener in the global scope, which will be called
synchronously whenever the event type
is dispatched.
addEventListener('unload', () => { console.log('All finished!'); });
...
dispatchEvent(new Event('unload'));
Type Parameters Jump to heading
Jump to headingK extends keyof WindowEventMap
Parameters Jump to heading
Jump to headingtype: K
Jump to headinglistener: (this: Window,ev: WindowEventMap[K],) => any
optional
Jump to headingoptions: boolean | AddEventListenerOptions
Return Type Jump to heading
void
Jump to headingaddEventListener(type: string,listener: EventListenerOrEventListenerObject,options?: boolean | AddEventListenerOptions,): void
Parameters Jump to heading
Jump to headingtype: string
optional
Jump to headingoptions: boolean | AddEventListenerOptions
Return Type Jump to heading
void