alert that works in Node and the browser
- Uses
window.alert
in the browser. - Uses
kdialog
zenity
,yad
,notify-send
,xmessage
,dialog
, orwhiptail
on Linux and BSD (depending on what's available). - Uses
osascript
/System Events
on Mac. - Uses
cscript
on Windows (ormsg
ifcscript
fails). - Defaults to
console.log
.
npm i -S alert-node
import alert from 'alert-node'
alert('howdy')
If using the API, you can specify a program to use. This can be one of:
- dialog (Linux)
- kdialog (Linux)
- notify-send (Linux)
- whiptail (Linux)
- xmessage (Linux)
- yad (Linux)
- zenity (Linux)
- osascript (Mac)
- cscript (Windows)
- msg (Windows)
- console (
console.log
)
Note that this will override any internal checks to get the correct program, and will blow up if you get it wrong. It's advised to just use the default behavior.
import alert from 'alert-node'
alert('hey!', 'yad')
alert-node
also has a cli. npm i -g alert-node
and run alert 'sup brah'
.