0.1.6 • Published 11 years ago
native-msg-box v0.1.6
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
errand aresult. At the momenterrshould always benull.resultis one ofResult.YES Result.NOWhy not just a simple
trueorfalse? 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