0.0.1 • Published 6 years ago

async-dialog v0.0.1

Weekly downloads
8
License
MIT
Repository
github
Last release
6 years ago

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.