Don't allow real time interrupt until ready

This commit is contained in:
Bryan Ashby 2019-01-03 22:03:00 -07:00
parent 10517b1060
commit 6410637359
1 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,10 @@ exports.MenuModule = class MenuModule extends PluginModule {
this.cls = _.get(this.menuConfig.config, 'cls', Config().menus.cls); this.cls = _.get(this.menuConfig.config, 'cls', Config().menus.cls);
this.viewControllers = {}; this.viewControllers = {};
this.interrupt = (_.get(this.menuConfig.config, 'interrupt', MenuModule.InterruptTypes.Queued)).toLowerCase(); this.interrupt = (_.get(this.menuConfig.config, 'interrupt', MenuModule.InterruptTypes.Queued)).toLowerCase();
if(MenuModule.InterruptTypes.Realtime === this.interrupt) {
this.realTimeInterrupt = 'blocked';
}
} }
static get InterruptTypes() { static get InterruptTypes() {
@ -137,6 +141,7 @@ exports.MenuModule = class MenuModule extends PluginModule {
}, },
function finishAndNext(callback) { function finishAndNext(callback) {
self.finishedLoading(); self.finishedLoading();
self.realTimeInterrupt = 'allowed';
return self.autoNextMenu(callback); return self.autoNextMenu(callback);
} }
], ],
@ -194,7 +199,7 @@ exports.MenuModule = class MenuModule extends PluginModule {
} }
attemptInterruptNow(interruptItem, cb) { attemptInterruptNow(interruptItem, cb) {
if(MenuModule.InterruptTypes.Realtime !== this.interrupt) { if(this.realTimeInterrupt !== 'allowed' || MenuModule.InterruptTypes.Realtime !== this.interrupt) {
return cb(null, false); // don't eat up the item; queue for later return cb(null, false); // don't eat up the item; queue for later
} }