-
Notifications
You must be signed in to change notification settings - Fork 1
/
electronmain.js
43 lines (35 loc) · 1.37 KB
/
electronmain.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
const Splashscreen = require('@trodi/electron-splashscreen/index');
const {app, BrowserWindow} = require('electron');
const path = require('path');
const url = require('url');
const notify = require('electron-main-notification');
let win;
function createWindow () {
const windowOptions = {width: 1400, height: 900, show:false};
win = new BrowserWindow(windowOptions); // load the dist folder from Angular
// Open the DevTools optionally:
win.webContents.openDevTools();
win.on('closed', () => { win = null });
win = Splashscreen.initSplashScreen({
windowOpts: windowOptions,
templateUrl: path.join(__dirname, '', 'hangman.svg'),
delay: 0, // force show immediately since example will load fast
minVisible: 1500, // show for 1.5s so example is obvious
splashScreenOpts: {
height: 500,
width: 500,
transparent: true,
},
});
win.loadURL(url.format({ pathname: path.join(__dirname, 'dist/index.html'), protocol: 'file:', slashes: true }));
win.setMenu(null);
}
app.setAppUserModelId('Hangman');
app.on('ready', createWindow);
app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() } });
app.on('activate', () => { if (win === null) { createWindow() } });
app.on('ready', () => {
notify('Welcome!', { body: 'This is Hangman in Electron!' }, () => {
console.log('The notification got clicked on!')
})
});