-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
61 lines (52 loc) · 1.39 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
const { app, BrowserWindow, Menu, ipcMain } = require('electron');
const moment = require("moment")
const findermenu = [
{
label: "操作",
submenu: [
{
label: "请勿尝试切换窗口",
accelerator: 'Cmd+Tab'
}
]
}
];
const menu = Menu.buildFromTemplate(findermenu);
Menu.setApplicationMenu(menu);
//通过将数组菜单设置为空数组,让顶部的finder菜单消失
function createWindow() {
const win = new BrowserWindow({
height: 600,
width: 800,
fullscreen: true,
frame: true,
//通过全屏选项和框架的消失,让用户无法关闭这个窗口
webPreferences: {
nodeIntegration: true,
contextIsolation: false
},
});
win.setTitle('阅读器');
win.loadFile('./src/first.html');
win.setFullScreen(true);
//设置全屏
}
setInterval(() => {
var hour = moment(new Date()).format("HH");
var mins = moment(new Date()).format("mm");
if (hour == 19 && mins == 20) {
app.whenReady().then(createWindow);
}
}, 60000)
// app.whenReady().then(createWindow);
//启动窗口
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});