electron-demo.js/startup-render.js

20 lines
463 B
JavaScript
Raw Normal View History

2017-05-19 19:19:43 +00:00
'use strict';
2017-04-24 23:21:00 +00:00
var electron = require('electron');
var ipc = electron.ipcRenderer;
ipc.on('startupState', function (e, state) {
var checkbox = document.getElementsByClassName('auto-start')[0];
checkbox.checked = state;
});
setTimeout(function () {
ipc.send('reqStartupState');
}, 1000);
document.body.addEventListener('change', function (ev) {
if (ev.target.classList.contains('auto-start')) {
ipc.send('startupChange', ev.target.checked);
}
});