forked from P2Pigeon/pigeon-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
48 lines (39 loc) · 1.17 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
const { ipcMain, app, BrowserWindow } = require("electron");
app.commandLine.appendSwitch('ignore-certificate-errors')
app.commandLine.appendSwitch('allow-insecure-localhost', 'true')
ipcMain.on("messageFromRenderer", (event, message) => {
console.log("Electron ipcMain Process Received message from ipcRenderer:", message);
event.sender.send("messageFromMain", "Hello from main!");
});
const server = require("./app/src/");
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 1200,
height: 700,
title: "Pigeon",
webPreferences: {
nodeIntegration: true,
webSecurity: false,
contextIsolation: false,
enableRemoteModule: true
},
});
mainWindow.loadURL("https://localhost:3000");
mainWindow.on("closed", function () {
mainWindow = null;
});
}
app.on("ready", createWindow);
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
event.preventDefault();
callback(true);
});
app.on("resize", function (e, x, y) {
mainWindow.setSize(x, y);
});
app.on("window-all-closed", function () {
if (process.platform !== "darwin") {
app.quit();
}
});