Cleanup & prep for real-time interrupt
This commit is contained in:
parent
b3930d1999
commit
cc9c143927
|
@ -42,14 +42,6 @@ exports.MenuModule = class MenuModule extends PluginModule {
|
|||
this.detachViewControllers();
|
||||
}
|
||||
|
||||
toggleInterruptionAndDisplayQueued(cb) {
|
||||
this.enableInterruption();
|
||||
this.displayQueuedInterruptions( () => {
|
||||
this.disableInterruption();
|
||||
return cb(null);
|
||||
});
|
||||
}
|
||||
|
||||
initSequence() {
|
||||
const self = this;
|
||||
const mciData = {};
|
||||
|
@ -185,6 +177,14 @@ exports.MenuModule = class MenuModule extends PluginModule {
|
|||
}
|
||||
}
|
||||
|
||||
toggleInterruptionAndDisplayQueued(cb) {
|
||||
this.enableInterruption();
|
||||
this.displayQueuedInterruptions( () => {
|
||||
this.disableInterruption();
|
||||
return cb(null);
|
||||
});
|
||||
}
|
||||
|
||||
displayQueuedInterruptions(cb) {
|
||||
if(true !== this.interruptable) {
|
||||
return cb(null);
|
||||
|
@ -193,7 +193,7 @@ exports.MenuModule = class MenuModule extends PluginModule {
|
|||
async.whilst(
|
||||
() => this.client.interruptQueue.hasItems(),
|
||||
next => {
|
||||
this.client.interruptQueue.display( (err, interruptItem) => {
|
||||
this.client.interruptQueue.displayNext( (err, interruptItem) => {
|
||||
if(err) {
|
||||
return next(err);
|
||||
}
|
||||
|
@ -211,6 +211,10 @@ exports.MenuModule = class MenuModule extends PluginModule {
|
|||
)
|
||||
}
|
||||
|
||||
attemptInterruptNow(interruptItem, cb) {
|
||||
return cb(null, false);
|
||||
}
|
||||
|
||||
getSaveState() {
|
||||
// nothing in base
|
||||
}
|
||||
|
|
|
@ -43,12 +43,16 @@ module.exports = class UserInterruptQueue
|
|||
return this.queue.length > 0;
|
||||
}
|
||||
|
||||
display(cb) {
|
||||
displayNext(cb) {
|
||||
const interruptItem = this.queue.pop();
|
||||
if(!interruptItem) {
|
||||
return cb(null);
|
||||
}
|
||||
|
||||
return interruptItem ? this.displayWithItem(interruptItem, cb) : cb(null);
|
||||
}
|
||||
|
||||
displayWithItem(interruptItem, cb) {
|
||||
if(interruptItem.cls) {
|
||||
this.client.term.rawWrite(ANSI.clearScreen());
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue