import { prompt } from "https://deno.land/x/ayonli_jsext@v0.9.72/dialog.ts";
Displays a dialog with a message prompting the user to input some text, and to wait until the user either submits the text or cancels the dialog.
Examples
Example 1
Example 1
import { prompt } from "@ayonli/jsext/dialog";
const name = await prompt("What's your name?");
if (name) {
console.log(`Hello, ${name}!`);
}
Example 2
Example 2
// with default value
import { prompt } from "@ayonli/jsext/dialog";
const name = await prompt("What's your name?", "John Doe");
if (name) {
console.log(`Hello, ${name}!`);
}
Examples
Example 1
Example 1
// input password
import { prompt } from "@ayonli/jsext/dialog";
const password = await prompt("Enter your password:", { type: "password" });
if (password) {
console.log("Your password is:", password);
}