summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.window.d.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-06-15 11:16:06 +1000
committerGitHub <noreply@github.com>2021-06-15 11:16:06 +1000
commit1eac527adb8263acd6d6cc1147e53caa901d938d (patch)
treebbfce7b7aa229eaab652ec0bcc5f29d7cb968536 /cli/dts/lib.deno.window.d.ts
parent0acd0602bb087c0d4a938ae09ff42c096e5fb4f2 (diff)
fix(cli): improve worker types (#10965)
Diffstat (limited to 'cli/dts/lib.deno.window.d.ts')
-rw-r--r--cli/dts/lib.deno.window.d.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/cli/dts/lib.deno.window.d.ts b/cli/dts/lib.deno.window.d.ts
index 3c985e641..00100768b 100644
--- a/cli/dts/lib.deno.window.d.ts
+++ b/cli/dts/lib.deno.window.d.ts
@@ -67,6 +67,31 @@ declare function confirm(message?: string): boolean;
*/
declare function prompt(message?: string, defaultValue?: string): string | null;
+/** 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'));
+ */
+declare function addEventListener(
+ type: string,
+ callback: EventListenerOrEventListenerObject | null,
+ options?: boolean | AddEventListenerOptions | undefined,
+): void;
+
+/** Remove a previously registered event listener from the global scope
+ *
+ * const lstnr = () => { console.log('hello'); };
+ * addEventListener('load', lstnr);
+ * removeEventListener('load', lstnr);
+ */
+declare function removeEventListener(
+ type: string,
+ callback: EventListenerOrEventListenerObject | null,
+ options?: boolean | EventListenerOptions | undefined,
+): void;
+
// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
// The types there must first be split into window, worker and global types.
/** The location (URL) of the object it is linked to. Changes done on it are