@heisian/cocoadialog
Version:
Node.js wrapper for cocoaDialog
61 lines (43 loc) • 1.29 kB
Markdown
> Node.js wrapper for [cocoaDialog]
**Note:** Issues with the actual cocoaDialog application should be filed in its [issue queue](https://github.com/mstratman/cocoadialog/issues).
```
$ npm install --save cocoadialog
```
```js
const cocoaDialog = require('cocoadialog').setGlobalOption({
stringOutput: true
});
cocoaDialog.msgBox()
.setTitle('This is the title')
.setIcon('caution')
.setLabel('This is the label')
.setButtons('Ok', 'Cancel', 'More')
.open()
.then(result => {
if (result.button === 'Ok') {
console.log('Ok button was clicked.');
}
else if (result.button === 'More') {
console.log('More button was clicked.');
}
})
.catch(result => {
if (result.hasAborted()) {
console.log('Cancel button was clicked.');
}
else {
console.error(result.error);
}
});
```
* [MsgBox](https://unicorn-fail.github.io/node-cocoadialog/?content=msgbox)
* [ProgressBar](https://unicorn-fail.github.io/node-cocoadialog//?content=progressbar)
[](https://unicorn-fail.github.io/node-cocoadialog/?api)
MIT © [Mark Carver](https://github.com/markcarver)
[]: http://mstratman.github.io/cocoadialog/#documentation3.0