Interface WindowEventHandlers
interface WindowEventHandlers {
onafterprint: ((this: WindowEventHandlers, ev: Event) => any) | null;
onbeforeprint: ((this: WindowEventHandlers, ev: Event) => any) | null;
onbeforeunload:
| ((this: WindowEventHandlers, ev: BeforeUnloadEvent) => any)
| null;
ongamepadconnected:
| ((this: WindowEventHandlers, ev: GamepadEvent) => any)
| null;
ongamepaddisconnected:
| ((this: WindowEventHandlers, ev: GamepadEvent) => any)
| null;
onhashchange:
| ((this: WindowEventHandlers, ev: HashChangeEvent) => any)
| null;
onlanguagechange: ((this: WindowEventHandlers, ev: Event) => any) | null;
onmessage: ((this: WindowEventHandlers, ev: MessageEvent) => any) | null;
onmessageerror:
| ((this: WindowEventHandlers, ev: MessageEvent) => any)
| null;
onoffline: ((this: WindowEventHandlers, ev: Event) => any) | null;
ononline: ((this: WindowEventHandlers, ev: Event) => any) | null;
onpagehide:
| ((this: WindowEventHandlers, ev: PageTransitionEvent) => any)
| null;
onpagereveal:
| ((this: WindowEventHandlers, ev: PageRevealEvent) => any)
| null;
onpageshow:
| ((this: WindowEventHandlers, ev: PageTransitionEvent) => any)
| null;
onpageswap: ((this: WindowEventHandlers, ev: PageSwapEvent) => any) | null;
onpopstate: ((this: WindowEventHandlers, ev: PopStateEvent) => any) | null;
onrejectionhandled:
| ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any)
| null;
onstorage: ((this: WindowEventHandlers, ev: StorageEvent) => any) | null;
onunhandledrejection:
| ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any)
| null;
onunload: ((this: WindowEventHandlers, ev: Event) => any) | null;
addEventListener<K extends keyof WindowEventHandlersEventMap>(
type: K,
listener: (
this: WindowEventHandlers,
ev: WindowEventHandlersEventMap[K],
) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
removeEventListener<K extends keyof WindowEventHandlersEventMap>(
type: K,
listener: (
this: WindowEventHandlers,
ev: WindowEventHandlersEventMap[K],
) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
}
onafterprint: ((this: WindowEventHandlers, ev: Event) => any) | null;
onbeforeprint: ((this: WindowEventHandlers, ev: Event) => any) | null;
onbeforeunload:
| ((this: WindowEventHandlers, ev: BeforeUnloadEvent) => any)
| null;
ongamepadconnected:
| ((this: WindowEventHandlers, ev: GamepadEvent) => any)
| null;
ongamepaddisconnected:
| ((this: WindowEventHandlers, ev: GamepadEvent) => any)
| null;
onhashchange:
| ((this: WindowEventHandlers, ev: HashChangeEvent) => any)
| null;
onlanguagechange: ((this: WindowEventHandlers, ev: Event) => any) | null;
onmessage: ((this: WindowEventHandlers, ev: MessageEvent) => any) | null;
onmessageerror:
| ((this: WindowEventHandlers, ev: MessageEvent) => any)
| null;
onoffline: ((this: WindowEventHandlers, ev: Event) => any) | null;
ononline: ((this: WindowEventHandlers, ev: Event) => any) | null;
onpagehide:
| ((this: WindowEventHandlers, ev: PageTransitionEvent) => any)
| null;
onpagereveal:
| ((this: WindowEventHandlers, ev: PageRevealEvent) => any)
| null;
onpageshow:
| ((this: WindowEventHandlers, ev: PageTransitionEvent) => any)
| null;
onpageswap: ((this: WindowEventHandlers, ev: PageSwapEvent) => any) | null;
onpopstate: ((this: WindowEventHandlers, ev: PopStateEvent) => any) | null;
onrejectionhandled:
| ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any)
| null;
onstorage: ((this: WindowEventHandlers, ev: StorageEvent) => any) | null;
onunhandledrejection:
| ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any)
| null;
onunload: ((this: WindowEventHandlers, ev: Event) => any) | null;
addEventListener<K extends keyof WindowEventHandlersEventMap>(
type: K,
listener: (
this: WindowEventHandlers,
ev: WindowEventHandlersEventMap[K],
) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
removeEventListener<K extends keyof WindowEventHandlersEventMap>(
type: K,
listener: (
this: WindowEventHandlers,
ev: WindowEventHandlersEventMap[K],
) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
}
Hierarchy
- WindowEventHandlers (View Summary)
Index
Properties
Methods
Properties
onafterprint
onbeforeprint
onbeforeunload
ongamepadconnected
ongamepaddisconnected
onhashchange
onlanguagechange
onmessage
onmessageerror
onoffline
ononline
onpagehide
onpagereveal
onpageshow
onpageswap
onpopstate
onrejectionhandled
onstorage
onunhandledrejection
onunload
Methods
addEventListener
- addEventListener<K extends keyof WindowEventHandlersEventMap>(
type: K,
listener: (
this: WindowEventHandlers,
ev: WindowEventHandlersEventMap[K],
) => any,
options?: boolean | AddEventListenerOptions,
): voidType Parameters
- K extends keyof WindowEventHandlersEventMap
Parameters
- type: K
- listener: (this: WindowEventHandlers, ev: WindowEventHandlersEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidParameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
removeEventListener
- removeEventListener<K extends keyof WindowEventHandlersEventMap>(
type: K,
listener: (
this: WindowEventHandlers,
ev: WindowEventHandlersEventMap[K],
) => any,
options?: boolean | EventListenerOptions,
): voidType Parameters
- K extends keyof WindowEventHandlersEventMap
Parameters
- type: K
- listener: (this: WindowEventHandlers, ev: WindowEventHandlersEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidParameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
MDN Reference