interface Window
extends EventTarget
Represents the global window object in the Deno runtime environment.
While Deno doesn't have a browser window, this interface mimics browser window functionality for compatibility with web APIs. It provides access to global properties and methods such as timers, storage, and event handling.
Examples #
#
// Accessing global objects
const localStorage = window.localStorage;
// Event handling
window.addEventListener("unhandledrejection", (event) => {
console.log("Unhandled promise rejection:", event.reason);d
});
Properties #
#onerror: ((this: Window,ev: ErrorEvent,) => any) | null
#onbeforeunload: (() => any) | null
#onunhandledrejection: ((this: Window,) => any) | null
#onrejectionhandled: ((this: Window,) => any) | null
Methods #
#addEventListener<K extends keyof WindowEventMap>(type: K,listener: (this: Window,ev: WindowEventMap[K],) => any,options?: boolean | AddEventListenerOptions,): void
#addEventListener(type: string,listener: EventListenerOrEventListenerObject,options?: boolean | AddEventListenerOptions,): void
#removeEventListener<K extends keyof WindowEventMap>(type: K,listener: (this: Window,ev: WindowEventMap[K],) => any,options?: boolean | EventListenerOptions,): void
#removeEventListener(): void