forked from wulkano/Kap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabout.js
51 lines (41 loc) · 1.15 KB
/
about.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
const electron = require('electron');
const {is} = require('electron-util');
const {ipcMain: ipc} = require('electron-better-ipc');
const delay = require('delay');
const loadRoute = require('./utils/routes');
const {closeAllCroppers} = require('./cropper');
const {BrowserWindow} = electron;
let aboutWindow;
const openAboutWindow = () => {
closeAllCroppers();
if (aboutWindow) {
aboutWindow.show();
return;
}
aboutWindow = new BrowserWindow({
width: 284,
height: 200,
resizable: false,
maximizable: false,
minimizable: false,
fullscreenable: false,
title: '',
center: true,
webPreferences: {
nodeIntegration: true,
webSecurity: !is.development // Disable webSecurity in dev to load video over file:// protocol while serving over insecure http, this is not needed in production where we use file:// protocol for html serving.
},
show: false
});
loadRoute(aboutWindow, 'about');
ipc.answerRenderer('about-ready', async () => {
await delay(100);
aboutWindow.show();
});
aboutWindow.on('close', () => {
aboutWindow = null;
});
};
module.exports = {
openAboutWindow
};