macOS implementation of notifications in the main process
This commit is contained in:
parent
37ed44cf1c
commit
5dd4d6a961
9 changed files with 351 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
const {app, BrowserWindow} = require('electron')
|
||||
const {app, BrowserWindow, Notification} = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
let mainWindow = null
|
||||
|
@ -27,5 +27,19 @@ exports.load = (appUrl) => {
|
|||
mainWindow = new BrowserWindow(options)
|
||||
mainWindow.loadURL(appUrl)
|
||||
mainWindow.focus()
|
||||
|
||||
const n = new Notification({
|
||||
title: 'Hello World',
|
||||
body: 'This is the long and complicated body for this notification that just goes on and on and on and never really seems to stop',
|
||||
silent: true,
|
||||
icon: '/Users/samuel/Downloads/ninja.png',
|
||||
hasReply: true,
|
||||
replyPlacehodler: 'Type Here!!'
|
||||
});
|
||||
n.on('show', () => console.log('showed'));
|
||||
n.on('click', () => console.info('clicked!!'));
|
||||
n.on('reply', (e, reply) => console.log('Replied:', reply));
|
||||
|
||||
n.show();
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue