forked from zsxsoft/danmu-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
42 lines (37 loc) · 1.06 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
const electron = require('electron');
const {app, BrowserWindow} = electron;
global.coordinator = new(require('events').EventEmitter);
global.windows = {};
coordinator.on('exit', () => {
app.exit(0);
});
app.on('window-all-closed', () => {
app.exit(0);
});
app.on('ready', () => {
windows.panelWindow = new BrowserWindow({
width: 390,
height: 150,
resizable: false,
icon: `${__dirname}/danmu.png`,
});
windows.panelWindow.loadURL(`file://${__dirname}/panel.html`);
windows.panelWindow.on('closed', () => {
//app.exit();
});
windows.panelWindow.setMenu(null);
windows.mainWindow = new BrowserWindow({
transparent: true,
frame: false,
toolbar: false,
resizable: true,
title: "DANMU Client",
alwaysOnTop: true,
icon: __dirname + '/danmu.png',
});
windows.mainWindow.loadURL(`file://${__dirname}/index.html`);
windows.mainWindow.on('closed', () => {
coordinator.emit("exit");
});
windows.mainWindow.setMenu(null);
});