native-msg-box
v0.1.6
Published
Make a native msg box appear
Downloads
59
Maintainers
Readme
native-msg-box
Allows you to display a native MessageBox / Dialog.
By native we mean an OS level, not a browser level dialog.
Example:
var msgbox = require('native-msg-box');
msgbox.prompt({
msg: "Hunt the Wumpus?",
title: "Game"
}, function(err, result) {
switch (result) {
case msgbox.Result.YES:
console.log("pressed yes");
break;
case msgbox.Result.NO:
console.log("pressed no");
break;
}
});
API:
prompt(options, callback)
options
msg
{string} REQUIRED The message to displaytitle
{string} optional. Title for dialog (not available on all OSes ... yet?)callback
The callback gets passed an
err
and aresult
. At the momenterr
should always benull
.result
is one ofResult.YES Result.NO
Why not just a simple
true
orfalse
? Because the future possibility of more values likeCancel
,Retry
, etc..
Prerequisites
Currently the Linux verison requires wmctrl
and zentiy
.
To Do
Add more dialog types. For example
- a single string prompt
"Enter Name: ____"
- other buttons like "Ok", "Cancel"
- a single string prompt