-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add alert, confirm, and prompt #7507
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When not interactive, we should do what browsers do when dialog boxes are disabled.
af5b6eb
to
e368eff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I like this, anything speaking against merging this? =) |
@kt3k this looks great! I love how simple the implementation is and having this API enables users to create simple CLI scripts without additional libraries. Please the branch so we can land it |
@bartlomieju Thank you for the feedbacks! Rebased the branch! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great feature @kt3k!
This reverts commit 0dcaea7.
These are awesome. I hope to teach kids programming and see Deno as a perfect way to provide everything they will need in one executable. I can even teach typed vs untyped going from JS to TS, these kinds of simple API's to do essential things are so important. It is the difference between friendly and easy to understand vs annoying and pointless time-wasting. |
Is there any way to use these as promise instead of blocking? edit: guess it could be a child process that reads from console but that sounds over the top |
@Bestulo Alert, confirm and prompt are all abstractions over a simple stdin/stdout program, it's quite easy to implement asynchronously without this API |
This PR adds
alert
,confirm
, andprompt
functions from web standards.You can write simple interaction script like the below with this change.
Maybe these features are not so important for advanced users, but I think these could be very helpful for beginners of Deno or learners of the language.
closes #4257