-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
42 lines (34 loc) · 1.07 KB
/
Copy pathmain.js
File metadata and controls
42 lines (34 loc) · 1.07 KB
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 { app, BrowserWindow, Menu } = require('electron');
const path = require('path');
const isDev = !app.isPackaged;
function createWindow() {
const win = new BrowserWindow({
width: 480,
height: 760,
minWidth: 400,
minHeight: 600,
backgroundColor: '#12151f',
icon: path.join(__dirname, 'assets', 'icon.ico'),
title: 'ARCWorks Simple Dictionary',
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
nodeIntegration: false,
sandbox: false
}
});
// A plain "very simple" app doesn't need a menu bar cluttering the window.
win.setMenuBarVisibility(false);
Menu.setApplicationMenu(null);
win.loadFile(path.join(__dirname, 'renderer', 'index.html'));
if (isDev && process.env.OPEN_DEVTOOLS === '1') {
win.webContents.openDevTools({ mode: 'detach' });
}
}
app.whenReady().then(createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});