mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 04:52:26 -05:00
docs: JSDocs examples for prompt, confirm, and alert (#27695)
Adds examples
This commit is contained in:
parent
e54d467812
commit
8d2f76ae36
1 changed files with 24 additions and 0 deletions
24
cli/tsc/dts/lib.deno.window.d.ts
vendored
24
cli/tsc/dts/lib.deno.window.d.ts
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue