Skip to content

Elhebert/async-dialog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Asynchronous Dialog

Software License npm npm

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

Fine, I'll be honest, it's not trully async, just a promisfied version of the native prompts, it's still blocking the code excecution. But still, it's usefull 🧐

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.

About

async, promise compatible, native dialog

Resources

License

Stars

Watchers

Forks

Packages

No packages published