-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
56 lines (44 loc) · 1.11 KB
/
Copy pathmain.js
File metadata and controls
56 lines (44 loc) · 1.11 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
52
53
54
55
56
const electron = require("electron");
const ipcMain = electron.ipcMain;
// Module to control application life.
const app = electron.app;
const Menu = electron.Menu;
const BrowserWindow = electron.BrowserWindow;
const nativeImage = electron.nativeImage;
const path = require("path");
const url = require("url");
const fs = require("fs");
let mainWindow;
const icon = nativeImage.createFromPath(path.join(__dirname, "icon.png"));
const audioPath = path.join(__dirname, "/audio/");
const debug = process.argv[2] == "debug";
function createWindow() {
mainWindow = new BrowserWindow({
title: "AudioTrainer",
titleBarStyle: "hidden",
icon: icon
});
mainWindow.loadURL(
url.format({
pathname: path.join(__dirname, "src/index.html"),
protocol: "file:",
slashes: true
})
);
mainWindow.on("closed", quit);
if (debug) {
mainWindow.openDevTools({ detach: true });
}
}
function quit() {
app.quit();
}
app.on("ready", function() {
createWindow();
});
app.on("window-all-closed", quit);
app.on("activate", function() {
if (mainWindow === null) {
createWindow();
}
});