This repository has been archived by the owner on Jan 14, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.js
85 lines (68 loc) · 1.96 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
process.env.NODE_ENV = 'production'; // change this value to 'development' while developing
const electron = require('electron');
const BrowserWindow = electron.BrowserWindow;
const path = require('path');
const url = require('url');
const { ipcMain } = require('electron');
const app = electron.app;
if (process.env.NODE_ENV === 'development') {
/* require('electron-reload')(__dirname);
const logger = require('electron-timber'); */
}
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
title: "qikQR",
width: 344,
height: 540,
resizable: false,
frame: false,
maximizable: false,
fullscreenable: false,
webPreferences: {
nodeIntegration: true
}
});
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'app', 'view', 'index.html'),
protocol: 'file:',
slashes: true
}));
mainWindow.on('closed', function () {
mainWindow = null;
});
//mainWindow.webContents.openDevTools();
}
app.on('ready', function () {
// NOTE for development purpose electron process GUI
/* const { openProcessManager } = require('electron-process-manager');
openProcessManager(); */
createWindow();
});
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
// logger.warn("app going to Quit");
app.quit();
}
});
app.on('activate', function () {
if (mainWindow === null) {
createWindow();
}
});
ipcMain.on("update the settings config", (event, arg) => {
//logger.log("new configuration set by user which need to be updated ");
mainWindow.webContents.send("update config", "update");
});
ipcMain.on("logger", (event, arg) => {
if (arg == "settings: save button clicked") {
mainWindow.webContents.send("update-config", "true");
//logger.log("sent to renderer to update the config-data");
}
});
ipcMain.on("logger-error", (event, arg) => {
//logger.error(arg);
});
ipcMain.on("logger-warn", (event, arg) => {
//logger.warn(arg);
});