forked from dro248/electron_player
-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
37 lines (31 loc) · 976 Bytes
/
app.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
const { app, BrowserWindow, ipcMain } = require('electron')
const path = require('path')
const argv = process.argv;
var mainWindow = null;
function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1000,
height: 780,
fullscreenable: true,
frame: true,
icon: path.join(__dirname, '/resources/filmstrip.png'),
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadURL('file://' + __dirname + '/renderer/player.html')
}
app.on('ready', createWindow)
ipcMain.on('request-cmd-argv', (event, arg) => {
event.reply('response-cmd-argv', argv)
})
ipcMain.on('toggle-dev-tools', (event, annotationMode) => {
if (annotationMode && !mainWindow.webContents.isDevToolsOpened()) {
mainWindow.webContents.toggleDevTools()
}
else if (!annotationMode && mainWindow.webContents.isDevToolsOpened()) {
mainWindow.webContents.toggleDevTools()
}
})