mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-17 05:58:41 -09:00
index: notify windows of config changes
This commit is contained in:
parent
24f1ae657e
commit
fcb221456d
1 changed files with 7 additions and 1 deletions
8
index.js
8
index.js
|
|
@ -6,6 +6,7 @@ const genUid = require('uid2');
|
||||||
const { resolve } = require('path');
|
const { resolve } = require('path');
|
||||||
const isDev = require('electron-is-dev');
|
const isDev = require('electron-is-dev');
|
||||||
const AutoUpdater = require('./auto-updater');
|
const AutoUpdater = require('./auto-updater');
|
||||||
|
const config = require('./config');
|
||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
console.log('running in dev mode');
|
console.log('running in dev mode');
|
||||||
|
|
@ -24,7 +25,7 @@ const url = 'file://' + resolve(
|
||||||
console.log('electron will open', url);
|
console.log('electron will open', url);
|
||||||
|
|
||||||
// initializate configuration
|
// initializate configuration
|
||||||
require('./config').init();
|
config.init();
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
// by subscribing to this event and nooping
|
// by subscribing to this event and nooping
|
||||||
|
|
@ -54,6 +55,10 @@ app.on('ready', () => {
|
||||||
const rpc = createRPC(win);
|
const rpc = createRPC(win);
|
||||||
const sessions = new Map();
|
const sessions = new Map();
|
||||||
|
|
||||||
|
const cfgUnsubscribe = config.subscribe(() => {
|
||||||
|
win.webContents.send('config change');
|
||||||
|
});
|
||||||
|
|
||||||
rpc.on('init', () => {
|
rpc.on('init', () => {
|
||||||
win.show();
|
win.show();
|
||||||
});
|
});
|
||||||
|
|
@ -140,6 +145,7 @@ app.on('ready', () => {
|
||||||
rpc.destroy();
|
rpc.destroy();
|
||||||
deleteSessions();
|
deleteSessions();
|
||||||
winCount--;
|
winCount--;
|
||||||
|
cfgUnsubscribe();
|
||||||
});
|
});
|
||||||
|
|
||||||
win.rpc = rpc;
|
win.rpc = rpc;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue