From 8d2f76ae363b8d6f2ae39594c5c08552e76d37f7 Mon Sep 17 00:00:00 2001 From: Phil Hawksworth Date: Thu, 16 Jan 2025 06:20:45 -0800 Subject: [PATCH] docs: JSDocs examples for prompt, confirm, and alert (#27695) Adds examples --- cli/tsc/dts/lib.deno.window.d.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cli/tsc/dts/lib.deno.window.d.ts b/cli/tsc/dts/lib.deno.window.d.ts index 6fc37ca08d..698b39c5df 100644 --- a/cli/tsc/dts/lib.deno.window.d.ts +++ b/cli/tsc/dts/lib.deno.window.d.ts @@ -226,6 +226,12 @@ declare var navigator: Navigator; * * If the stdin is not interactive, it does nothing. * + * @example + * ```ts + * // Displays the message "Acknowledge me! [Enter]" and waits for the enter key to be pressed before continuing. + * alert("Acknowledge me!"); + * ``` + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/alert * @category Platform * * @param message @@ -239,6 +245,15 @@ declare function alert(message?: string): void; * * If the stdin is not interactive, it returns false. * + * @example + * ```ts + * const shouldProceed = confirm("Do you want to proceed?"); + * + * // If the user presses 'y' or 'Y', the result will be true + * // If the user presses 'n' or 'N', the result will be false + * console.log("Should proceed?", shouldProceed); + * ``` + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm * @category Platform * * @param message @@ -256,6 +271,15 @@ declare function confirm(message?: string): boolean; * * If the stdin is not interactive, it returns null. * + * @example + * ```ts + * const pet = prompt("Cats or dogs?", "It's fine to love both!"); + * + * // Displays the user's input or the default value of "It's fine to love both!" + * console.log("Best pet:", pet); + * ``` + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt + * * @category Platform * * @param message