-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathmain.js
More file actions
40 lines (35 loc) · 723 Bytes
/
main.js
File metadata and controls
40 lines (35 loc) · 723 Bytes
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
const { app, BrowserWindow } = require("electron");
const electronLocalshortcut = require("electron-localshortcut");
let wins = new Array();
let win;
function createWindow() {
win = new BrowserWindow({
width: 350,
height: 750,
webPreferences: {
webSecurity: false
}
});
wins.push(win);
win.loadFile("index.html");
}
function listerDown() {
createWindow();
electronLocalshortcut.register(win, "Down", () => {
listerDown();
if (wins.length > 1){
wins.shift().close();
}
});
}
app.on("ready", () => {
listerDown();
});
app.on("activate", () => {
listerDown();
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});