-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
54 lines (44 loc) · 1.21 KB
/
index.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
const {app, BrowserWindow, ipcMain} = require('electron')
const path = require('path')
let win;
ipcMain.on('restart', () => {
if (win) {
win.loadURL('');
setTimeout(() => {
win.loadURL(getFramePath());
}, 500);
}
});
function getFramePath(resName) {
let locale = app.getLocale();
let supportedLanguage = ['ko'];
if (!supportedLanguage.includes(locale)) locale = 'ko';
return `file://${__dirname}/frame.html?locale=${locale}&resName=${resName}.html`;
}
function createWindow() {
win = new BrowserWindow({
width: 900, height: 600, webPreferences: {
nodeIntegration: true,
webSecurity: false,
enableRemoteModule: true,
contextIsolation: false
}, icon: path.join(__dirname, 'logo.ico'), frame: false
});
win.setMenu(null);
win.loadURL(getFramePath());
//win.webContents.openDevTools({mode: "detach"});
win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow();
}
});