-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
57 lines (44 loc) · 1.27 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
const { app, BrowserWindow, ipcMain } = require("electron");
let splash;
app.on("ready", () => {
mainWindow = new BrowserWindow({
title: "Electron-Example",
width: 1150,
height: 650,
minWidth: 550,
minHeight: 417,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
},
frame: false,
show: false,
});
splash = new BrowserWindow({
width: 350,
height: 350,
transparent: true,
frame: false,
alwaysOnTop: true,
resizable: false,
title: "Electron-Example"
});
splash.loadURL(`file://${__dirname}/app/splash.html`);
mainWindow.loadURL(`file://${__dirname}/app/index.html`);
ipcMain.handle("exit", () => {
BrowserWindow.getFocusedWindow().destroy();
console.log("exit-main");
});
ipcMain.handle("min", () => {
BrowserWindow.getFocusedWindow().minimize();
console.log("minimize-main");
});
ipcMain.handle("max", () => {
BrowserWindow.getFocusedWindow().maximize();
console.log("max-main");
});
mainWindow.once("ready-to-show", () => {
splash.destroy();
mainWindow.show();
});
});