forked from sugarlabs/musicblocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelectron-main.js
More file actions
39 lines (33 loc) · 838 Bytes
/
electron-main.js
File metadata and controls
39 lines (33 loc) · 838 Bytes
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
const { app, BrowserWindow } = require("electron");
const path = require("path");
require("./index.js");
function createWindow() {
const win = new BrowserWindow({
width: 1200,
height: 800,
title: "Music Blocks",
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
sandbox: true,
webSecurity: true,
enableRemoteModule: false
}
});
setTimeout(() => {
win.loadURL("http://127.0.0.1:3000");
}, 1000);
}
app.whenReady().then(() => {
createWindow();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});