This repository has been archived by the owner on Feb 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
62 lines (49 loc) · 1.79 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} = require('electron');
const path = require('path');
const ipc = require('electron').ipcMain;
var fs = require('fs');
let mainWindow;
app.on('window-all-closed', function() {
if (process.platform != 'darwin')
app.quit();
});
let ppapi_flash_path;
// Specify flash path.
// On Windows, it might be /path/to/pepflashplayer.dll
// On OS X, /path/to/PepperFlashPlayer.plugin
// On Linux, /path/to/libpepflashplayer.so
if(process.platform == 'win32'){
ppapi_flash_path = path.join(__dirname, 'pepflashplayer64.dll');
} else if (process.platform == 'linux') {
ppapi_flash_path = path.join(__dirname, 'libpepflashplayer.so');
} else if (process.platform == 'darwin') {
ppapi_flash_path = path.join(__dirname, 'PepperFlashPlayer.plugin');
}
app.commandLine.appendSwitch('ppapi-flash-path', ppapi_flash_path);
// Specify flash version, for example, v18.0.0.203
app.commandLine.appendSwitch('ppapi-flash-version', '25.0.0.127');
app.on('ready', function() {
mainWindow = new BrowserWindow({
'width': 750,
'height': 600,
'frame': false,
'icon': __dirname + '/icon.png',
'title': 'IOU Helper 2.0',
'webPreferences': {'plugins': true, 'allowRunningInsecureContent': true,
}
});
mainWindow.loadURL(`file://${__dirname}/index.html`);
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows 'nodeIntegration': false
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});
const {ipcMain} = require('electron')
ipcMain.on('subKong', (event, arg) => {
mainWindow.webContents.send('sendKong' , arg);
})
ipcMain.on('subSettings', (event, arg) => {
mainWindow.webContents.send('sendSettings' , arg);
})