-
Notifications
You must be signed in to change notification settings - Fork 56
/
index.js
50 lines (44 loc) · 1.22 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const electron = require('electron');
const path = require('path');
const notifier = require('node-notifier');
const server = require('./server/server.js');
// const fs = require('fs');
// const _ = require('lodash');
const { app, BrowserWindow, ipcMain, shell } = electron;
let mainWindow;
app.on('ready', () => {
mainWindow = new BrowserWindow({
webPreferences: { backgroundThrottling: false },
show: false,
icon: path.join(__dirname,'public','images','favicon3.icns')
});
mainWindow.loadURL(`http://localhost:4172`);
mainWindow.maximize();
mainWindow.show();
mainWindow.on('closed', () => {
mainWindow=null;
app.quit();
});
});
// app.on('quit', () => {
// server.close();
// })
ipcMain.on('playNotif', (event, name, message) => {
console.log('new message');
notifier.notify(
{
title: name,
message: message,
icon: path.join(__dirname, 'public', 'images', 'favicon3.png'), // Absolute path (doesn't work on balloons)
sound: true, // Only Notification Center or Windows Toasters
time: 1000,
timeout:1000,
expire:1000,
wait: false,
type: 'info'
},
function(err, response) {
// Response is response from notification
}
);
});