-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreferences.js
22 lines (17 loc) · 935 Bytes
/
preferences.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';
const { ipcRenderer } = require('electron');
const storage = require('./src/storage');
document.querySelector('#js-save-preferences').addEventListener('click', () => {
storage.set('play_pause', document.querySelector('#play_pause').value);
storage.set('next', document.querySelector('#next').value);
storage.set('prev', document.querySelector('#prev').value);
ipcRenderer.send('save-preferences', {
'play_pause': document.querySelector('#play_pause').value,
'next': document.querySelector('#next').value,
'prev': document.querySelector('#prev').value
});
event.preventDefault();
});
document.querySelector('#play_pause').value = storage.get('play_pause') || constants.DEFAULT_SHORTCUTS.PLAY_PAUSE;
document.querySelector('#next').value = storage.get('next') || constants.DEFAULT_SHORTCUTS.NEXT;
document.querySelector('#prev').value = storage.get('prev') || constants.DEFAULT_SHORTCUTS.PREV;