function addEventListener
Jump to headingaddEventListener<K extends keyof WindowEventMap>(type: K,listener: (this: Window,ev: WindowEventMap[K],) => any,options?: boolean | AddEventListenerOptions,): voidRegisters 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 WindowEventMapParameters Jump to heading
Jump to headingtype: KJump to headinglistener: (this: Window,ev: WindowEventMap[K],) => anyoptional
Jump to headingoptions: boolean | AddEventListenerOptionsReturn Type Jump to heading
voidJump to headingaddEventListener(type: string,listener: EventListenerOrEventListenerObject,options?: boolean | AddEventListenerOptions,): voidParameters Jump to heading
Jump to headingtype: stringoptional
Jump to headingoptions: boolean | AddEventListenerOptionsReturn Type Jump to heading
void