removeEventListener - Web documentation
function removeEventListener
removeEventListener<K extends keyof WindowEventMap>(
type: K,
listener: (
this: Window,
) => any
,
options?: boolean | EventListenerOptions,
): void

Remove a previously registered event listener from the global scope

const listener = () => { console.log('hello'); };
addEventListener('load', listener);
removeEventListener('load', listener);

Type Parameters

K extends keyof WindowEventMap

Parameters

type: K
listener: (
this: Window,
) => any
optional
options: boolean | EventListenerOptions

Return Type

void
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void

Parameters

type: string
optional
options: boolean | EventListenerOptions

Return Type

void