Installation
$ npm install electron-toaster;
Usage
// In main process.var app = ; // Module to control application life.var BrowserWindow = ; // Module to create native browser window. var Toaster = ;var toaster = ; // Keep a global reference of the window object, if you don't, the window will// be closed automatically when the javascript object is GCed.var mainWindow = null; app; app;
// In renderer process (web page). var ipc = ipcRenderer;var msg = title : "Awesome!" message : "Check this out!<br>Check this out!<br>Check this out!<br>Check this out!<br>Check this out!<br>Check this out!<br>" detail : "PI is equal to 3! - 0.0<br>PI is equal to 3! - 0.0<br>PI is equal to 3! - 0.0<br>PI is equal to 3! - 0.0<br>" width : 440 // height : 160, window will be autosized timeout : 6000 focus: true // set focus back to main window;ipc;
User interaction
If you need to do some stuffs at the main process on toaster click or when toaster was closed by timeout.
//in your main process. listen to the event 'electron-toaster-reply'. i.eipc
isAuto
parameter:
true
- if timeout was reached.
false
- if user interacted with toaster onclick.