import { addEventListener } from "https://deno.land/x/deno@v1.28.3/cli/tsc/dts/lib.deno.window.d.ts";
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
K extends keyof WindowEventMap
Parameters
type: K
listener: (this: Window, ev: WindowEventMap[K]) => any
optional
options: boolean | AddEventListenerOptionsParameters
listener: EventListenerOrEventListenerObject
optional
options: boolean | AddEventListenerOptions