Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 1.44 KB

readme.markdown

File metadata and controls

66 lines (45 loc) · 1.44 KB

dialogs

js-standard-style Greenkeeper badge

non blocking confirm, alert and prompt dialogs.

Theses native counterparts block the UI thread, are are not allowed in electron and some chrome extention contexts.

Try it out! view on requirebin

use with browserify:

methods

var Dialogs = require('dialogs')

var dialogs = Dialogs(opts={})

opts.ok default OK

opts.cancel default Cancel

opts.hostname default location.hostname

opts.icon optional url for icon

dialogs.alert([text], cb)

dialogs.prompt([text], [default], cb)

dialogs.confirm([text], cb)

dialogs.cancel()

Shortcut to cancel the open dialog if exists.

example

const Dialogs = require('dialogs')
const dialogs = Dialogs()
dialogs.alert('okidoki', ok => {
  console.log('alert', ok)
  dialogs.confirm('ok?', ok => {
    console.log('confirm', ok)
    dialogs.prompt('username', 'joe.smith@gmail.com', ok => {
      console.log('prompt with default', ok)
      dialogs.prompt('username', ok => {
        console.log('prompt', ok)
      })
    })
  })
})

install

With npm do:

npm install dialogs

license

MIT