async-dialog

0.0.1 • Public • Published

Asynchronous Dialog

Asynchronous version of native dialog functions alert, confirm and prompt.

Installation

$ npm install async-dialog

Usage

import { alert, comfirm, prompt } from 'async-dialog'
 
// Using promises
alert('this is an alert')
  .then()
 
confirm('I need confirmation to continue')
  .then(() => console.log('confirmed'))
  .catch(reasons => console.error(reasons))
 
prompt('Tell me something', 'something')
  .then(response => console(response))
  .catch(reasons => console.error(reasons))
 
// Using await
try {
  await alert('this is an alert')
  await confirm('I need confirmation to continue')
  const response = prompt('Tell me something', 'something')
} catch (reasons) {
  console.error(reasons)
}

License

This package is open-sourced software licensed under the MIT license.

Package Sidebar

Install

npm i async-dialog

Weekly Downloads

5

Version

0.0.1

License

MIT

Unpacked Size

3.16 kB

Total Files

4

Last publish

Collaborators

  • elhebert