-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
41 lines (34 loc) · 901 Bytes
/
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
const electron = require('electron');
const ipcMain = electron.ipcMain;
const {app} = electron;
const {BrowserWindow} = electron;
const storage = require('electron-json-storage');
let win;
function createWindow() {
win = new BrowserWindow({width: 1000, height: 700, frame: true, title: "Reactron Music Player"});
win.loadURL(`file://${__dirname}/index.html`);
win.on('closed', () => {
win = null;
});
};
ipcMain.on('save-store', (event, arg) => {
storage.set('redux-store', arg, function(error) {
if(error) throw error;
});
});
ipcMain.on('retrieve-store', (event, arg) => {
storage.get('redux-store', function(error, data) {
event.returnValue = data
});
});
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow();
}
});