-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
51 lines (41 loc) · 1.2 KB
/
Copy pathindex.js
File metadata and controls
51 lines (41 loc) · 1.2 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
43
44
45
46
47
48
49
50
51
const { app, globalShortcut, BrowserWindow, systemPreferences } = require('electron');
const debug = require('electron-debug');
const electron = require('electron');
const data = require('./data.json');
if(!app.isPackaged) {
try {
require('electron-reloader')(module);
} catch {}
}
const createWindow = async () => {
const win = new BrowserWindow({
title: "devola2",
width: 1200,
height: 800,
icon: __dirname + '/assets/favicon.ico',
fullscreen: true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
}
});
await win.loadFile('src/loading.html');
await systemPreferences.askForMediaAccess("microphone");
await systemPreferences.askForMediaAccess("camera");
await win.webContents.executeJavaScript(`sessionStorage.setItem('data', '${JSON.stringify(data)}')`)
await win.loadFile('src/orange-ui.html');
// if dev
win.webContents.openDevTools();
}
app.whenReady().then(() => {
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
});