Alert yourself when a long build or test run finishes without watching the terminal.
Add desktop notifications to an Electron app without writing platform-specific code.
Show interactive notifications with action buttons so the user can approve or reject something from your Node.js app.
Listen for notification events to know whether the user clicked or dismissed the popup.
Linux users need libnotify-bin installed separately, macOS and Windows require no extra system software.
Node-notifier is a Node.js library that lets a JavaScript program send desktop popup notifications to the user, using whatever native notification system the operating system provides. On macOS it uses the built-in Notification Center. On Windows 8 and later it uses toast notifications, the small pop-up cards that appear at the corner of the screen. On Linux it calls the system's notify library. When none of those are available, it falls back to Growl. The basic usage is a single function call with a title and a message. More options let you attach a custom icon, play a sound, add clickable action buttons, or even show a text input field where the user can type a reply. You can also listen for events, so your program knows when the user clicked the notification versus when it timed out and closed on its own. This is especially useful in developer tooling and desktop applications. Build scripts can alert you when a long compile finishes, Electron apps (desktop apps built with web technologies) can notify users without writing platform-specific code. The README notes that the library works well with Electron. Installation is through npm, Node's standard package manager. No extra system software is required on macOS or Windows. On Linux, a notification library such as libnotify-bin needs to be installed separately, though most Ubuntu systems include it by default. The library handles the differences between platforms automatically. If you call it the same way on all three operating systems, it finds the right local tool and formats the notification appropriately for each one, so you write the code once without worrying about platform-specific details.
← mikaelbr on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.