Initial version of hot-reload of config, menus, and prompts

* Themes use ES6 Map vs object{}
* Re-write and re-enable config cache using sane
* Events sent for config, prompt, or menu changes
* Event sent for theme changes
* Theme (or parent menu/prompt) changes cause re-merge and updates to connected clients
This commit is contained in:
Bryan Ashby 2018-06-13 21:02:00 -06:00
parent 1870db7d38
commit 4aab8224ed
8 changed files with 275 additions and 242 deletions

View file

@ -38,6 +38,7 @@ const User = require('./user.js');
const Config = require('./config.js').config;
const MenuStack = require('./menu_stack.js');
const ACS = require('./acs.js');
const Events = require('./events.js');
// deps
const stream = require('stream');
@ -110,6 +111,12 @@ function Client(/*input, output*/) {
this.input.on('data', this.dataHandler);
};
Events.on(Events.getSystemEvents().ThemeChanged, ( { themeId } ) => {
if(_.get(this.currentTheme, 'info.themeId') === themeId) {
this.currentTheme = require('./theme.js').getAvailableThemes().get(themeId);
}
});
//
// Peek at incoming |data| and emit events for any special