electron-notification-shim
Get Notification API events in Electron main-process. Perfect for adding Notification toasters in Windows with node-notifier or other solution.
Usage
Include it in your rendering-view like this:
require('electron-notification-shim')();
That's all. Now you'll receive notification-shim
events in your main-process, like this:
ipcMain.on('notification-shim', (e, msg) => { ... });
The msg
is a simple object: { title, options }
, which matches the two parameters sent to new Notification(title, options). You can send an event back with e.returnValue or e.sender.send() if you want to react to it in the rendering view as well.
Example code
Demos
Check the electron-notification-shim-demos page for different uses.
Sample
// Main process, main.js'use strict';const app = ;const ipc = ;const path = ;const BrowserWindow = ; app;
// Renderer process, browser.js;