-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
92 lines (75 loc) · 1.99 KB
/
main.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
console.log('console from main.js file');
const electron = require("electron");
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
//const {app, BrowserWindow} = require('electron')
const path = require('path');
const url = require('url');
let wind;
let wind2;
function createWindow() {
wind = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
},
});
wind2 = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
},
height: 150,
width5: 300,
frame: false,
show: false,
});
wind.loadURL(url.format(
{
pathname: path.join(__dirname, 'index.html'),
protocol: 'file',
slashes: true,
}
));
wind2.loadURL(url.format(
{
pathname: path.join(__dirname, 'indextwo.html'),
protocol: 'file',
slashes: true,
}
));
//to have an access of dev tools
wind.webContents.openDevTools();
// wind2.webContents.openDevTools();
wind.on('closed', () => {
wind = null;
});
wind2.on('closed', () => {
wind = null;
});
wind2.once('ready-to-show', () => {
wind2.show();
})
}
app.on('ready', createWindow);
// if all browser windows are closed
// we need to explicitely force closed the application.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
// on mac, if there are no windows open and we click
// on dock icon then we have to create window again
app.on('activate', () => {
if (wind === null) {
createWindow();
}
});
app.on('activate', () => {
if (wind2 === null) {
createWindow();
}
});