-
Notifications
You must be signed in to change notification settings - Fork 3
/
script.js
executable file
·70 lines (47 loc) · 1.48 KB
/
script.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
62
63
64
65
66
67
68
69
'use strict';
const electron = require( 'electron' ),
fs = require( 'fs' );
require('@electron/remote/main').initialize()
const debug = process.argv[2] === "debug";
electron.app.commandLine.appendSwitch('ignore-gpu-blacklist', 'true');
electron.Menu.setApplicationMenu( null );
const rootPath = 'file://' + __dirname + '/';
const basePath = !fs.existsSync( __dirname + "/compiled" ) ? rootPath
: rootPath + ( debug ? 'compiled/source/' : 'compiled/dist/' );
electron.app.on('ready', () => {
const win = new electron.BrowserWindow( {
icon: basePath + "resource/eduAnat2/icon.png",
title:'EduAnat2',
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
},
show:false
} );
require("@electron/remote/main").enable(win.webContents)
const url = basePath + 'index.html';
win.loadURL( url );
const splash = new electron.BrowserWindow( {
width: 410,
height: 402,
resizable:false,
frame: false,
alwaysOnTop: true
} );
if ( debug ) {
win.show();
win.webContents.openDevTools();
}
splash.loadURL( basePath + 'resource/eduAnat2/splash.html');
require("electron").ipcMain.once('qx-ready', function () {
win.show();
splash.destroy();
setTimeout( win.maximize.bind( win ), 200 );
} );
} )
.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if ( process.platform !== 'darwin' ) electron.app.quit();
} )