Spec-Zone.ru › Deno 1

addEventListener

Регистрирует обработчик события в глобальной области видимости, который будет вызываться синхронно всякий раз, когда событие type отправляется.

addEventListener('unload', () => { console.log('All finished!'); });
...
dispatchEvent(new Event('unload'));
function addEventListener<K extends keyof WindowEventMap>(
type: K,
listener: (this: Window, ev: WindowEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
function addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void

Регистрирует обработчик события в глобальной области видимости, который будет вызываться синхронно всякий раз, когда событие type отправляется.

addEventListener('unload', () => { console.log('All finished!'); });
...
dispatchEvent(new Event('unload'));

Типы параметров

K extends keyof WindowEventMap

Параметры

type: K
listener: (this: Window, ev: WindowEventMap[K]) => any
options?: boolean | AddEventListenerOptions optional

Тип возвращаемого значения

void
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void

Параметры

type: string
listener: EventListenerOrEventListenerObject
options?: boolean | AddEventListenerOptions optional

Тип возвращаемого значения

void

© 2018–2022 the Deno authors
https://doc.deno.land/deno/stable/~/addEventListener

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API