-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewMonitor.js
41 lines (32 loc) · 1021 Bytes
/
newMonitor.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
'use strict';
var { remote, ipcRenderer: comm } = require('electron');
var config = remote.getGlobal('config');
var process = remote.process;
var µ = query=>document.querySelector(query);
document.addEventListener('DOMContentLoaded', function (event) {
console.log('here');
var windows = null;
windows = config.windows;
config.windows.forEach(wind=> {
let newOpt = document.createElement('option');
newOpt.textContent = wind.label;
newOpt.value = wind.label;
µ('#windowOpts').appendChild(newOpt);
});
µ('#windows').onchange = ()=> {
var wnd = config.windows.find(wind=>wind.label == µ('#windows').value);
µ('#demo').src = wnd.file;
};
µ('#save').onmousedown = ()=> {
if (µ('#windows').value) {
comm.send('window-select', {
window: µ('#windows').value,
});
} else {
//µ('#growl').message('Please select a window', 'warn');
}
};
process.on('SIGINT', ()=> {
process.nextTick(function () { process.exit(0); });
});
});