Repository: denoland/deno
File: cli/tsc/dts/lib.deno.window.d.ts (TypeScript)

Code before:
/** @category Platform */
declare var closed: boolean;
/** @category Platform */
declare function close(): void;
/** @category Events */
declare var onerror: ((this: Window, ev: ErrorEvent) => any) | null;
/** @category Events */
declare var onload: ((this: Window, ev: Event) => any) | null;
/** @category Events */
declare var onbeforeunload: ((this: Window, ev: Event) => any) | null;
/** @category Events */
declare var onunload: ((this: Window, ev: Event) => any) | null;
/** @category Events */
declare var onunhandledrejection:
  | ((this: Window, ev: PromiseRejectionEvent) => any)
  | null;
/** 
 * Deno's {@linkcode localStorage} API provides a way to store key-value pairs in a web-like environment, 
 * similar to the Web Storage API found in browsers. It allows developers to persist data across sessions in a Deno application. 
 * This API is particularly useful for applications that require a simple and effective way to store data locally.
 * 
 * - Key-Value Storage: Stores data as key-value pairs.
 * - Persistent: Data is retained even after the application is closed.
 * - Synchronous API: Operations are performed synchronously.
 *
 * {@linkcode localStorage} is similar to {@linkcode sessionStorage}, and shares the same API methods, visible in the {@linkcode Storage} type.
 * 
 * @example
 * ```ts
 * // Set a value in localStorage
 * localStorage.setItem("key", "value");
 * 
 * // Get a value from localStorage
 * const value = localStorage.getItem("key");
 * console.log(value); // Output: "value"
 * 
 * // Remove a value from localStorage
 * localStorage.removeItem("key");
 * 
 * // Clear all values from localStorage
 * localStorage.clear();
 * ```
 * 
 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
 * @category Storage */
declare var localStorage: Storage;

/** 
 * Deno's {@linkcode sessionStorage} API operates similarly to the {@linkcode localStorage} API, but it is intended for storing data temporarily for the duration of a session. Data stored in sessionStorage is cleared when the page session ends, which typically occurs when the browser tab or window is closed. This makes it suitable for temporary data that you do not need to persist across browser sessions.
 * 
 * - Key-Value Storage: Stores data as key-value pairs.

Review comment (suggestion):
Ditto
```suggestion
 * `localStorage` is similar to {@linkcode sessionStorage}, and shares the same API methods, visible in the {@linkcode Storage} type.
```

Code after:
/** @category Platform */
declare var closed: boolean;

/**
 * Exits the current Deno process.
 *
 * This function terminates the process by signaling the runtime to exit.
 * Similar to exit(0) in posix. Its behavior is similar to the `window.close()`
 * method in the browser, but specific to the Deno runtime.
 *
 * Note: Use this function cautiously, as it will stop the execution of the
 * entire Deno program immediately.
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/close
 *
 * @example
 * ```ts
 * console.log("About to close the Deno process.");
 * close(); // The process will terminate here.
 * console.log("This will not be logged."); // This line will never execute.
 * ```
 *
 * @category Platform
 */
declare function close(): void;

/** @category Events */
declare var onerror: ((this: Window, ev: ErrorEvent) => any) | null;
/** @category Events */
declare var onload: ((this: Window, ev: Event) => any) | null;
/** @category Events */
declare var onbeforeunload: ((this: Window, ev: Event) => any) | null;
/** @category Events */
declare var onunload: ((this: Window, ev: Event) => any) | null;
/** @category Events */
declare var onunhandledrejection:
  | ((this: Window, ev: PromiseRejectionEvent) => any)
  | null;
/**
 * Deno's `localStorage` API provides a way to store key-value pairs in a
 * web-like environment, similar to the Web Storage API found in browsers.
 * It allows developers to persist data across sessions in a Deno application.
 * This API is particularly useful for applications that require a simple
 * and effective way to store data locally.
 *
 * - Key-Value Storage: Stores data as key-value pairs.
 * - Persistent: Data is retained even after the application is closed.
 * - Synchronous API: Operations are performed synchronously.
 *
 * `localStorage` is similar to {@linkcode sessionStorage}, and shares the same
 * API methods, visible in the {@linkcode Storage} type.