-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
42 lines (37 loc) · 1.16 KB
/
index.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
'use strict';
const path = require('path');
const { app, BrowserWindow, ipcMain } = require('electron');
const { Player } = require('./src/player');
const { YTouchBar } = require('./src/yTouchBar');
const { ShortcutManager } = require('./src/shortcutManager');
app.on('ready', () => {
let win = new BrowserWindow(
{
width: 1200, height: 800,
webPreferences: {
preload: path.join(__dirname, 'src/inject.js'),
nodeIntegration: true,
experimentalFeatures: true,
show: false,
icon: path.join(__dirname, 'build/icon.png')
},
}
);
const player = new Player(win, ipcMain);
const touchBar = new YTouchBar(player);
const shortcuts = new ShortcutManager(player);
player.on('EVENT_READY', () => {
if (process.env.NODE_ENV !== 'test') {
win.setTouchBar(touchBar.build());
shortcuts.bindKeys(win);
}
});
win.loadURL('https://music.yandex.ru');
win.on('closed', () => {
win = null;
});
win.on('ready-to-show', () => {
win.show();
win.focus();
});
});