-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathactions.js
More file actions
33 lines (28 loc) · 1 KB
/
actions.js
File metadata and controls
33 lines (28 loc) · 1 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
const { ipcMain, Notification} = require('electron')
const Storage = require('./storage');
class Actions {
constructor() {
this.window = null;
this.session = null;
this.forms = null;
this.storage = new Storage();
}
init(window) {
this.window = window;
ipcMain.on('modemConfigSaveSettings', this.modemConfigSaveSettings.bind(this));
ipcMain.on('modemConfigGetSettings', this.modemConfigGetSettings.bind(this));
}
modemConfigGetSettings(event) {
this.window.send('modemConfigGetSettingsData', this.storage.getData('modem-config'));
}
modemConfigSaveSettings(event, config) {
if (config?.modemIp) {
this.storage.setData('modem-config', config);
new Notification({ title: 'Modem Config', body: 'Save successful' }).show()
this.window.goToHome();
} else {
new Notification({ title: 'Modem Config', body: 'Save failed' }).show()
}
}
}
module.exports = Actions;