mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 12:47:13 +02:00
WIP on real-time interruptions (ie: incoming message)
Still need work on *when* they are allowed with good defaults, etc.
This commit is contained in:
parent
4025c3c643
commit
080d1727c2
2 changed files with 35 additions and 17 deletions
|
@ -35,8 +35,17 @@ module.exports = class UserInterruptQueue
|
|||
if(!_.isString(interruptItem.contents) && !_.isString(interruptItem.text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// pause defaulted on
|
||||
interruptItem.pause = _.get(interruptItem, 'pause', true);
|
||||
this.queue.push(interruptItem);
|
||||
|
||||
this.client.currentMenuModule.attemptInterruptNow(interruptItem, (err, ateIt) => {
|
||||
if(err) {
|
||||
// :TODO: Log me
|
||||
} else if(true !== ateIt) {
|
||||
this.queue.push(interruptItem);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
hasItems() {
|
||||
|
@ -61,8 +70,13 @@ module.exports = class UserInterruptQueue
|
|||
|
||||
if(interruptItem.contents) {
|
||||
Art.display(this.client, interruptItem.contents, err => {
|
||||
this.client.term.rawWrite('\r\n\r\n');
|
||||
return cb(err, interruptItem);
|
||||
if(err) {
|
||||
return cb(err);
|
||||
}
|
||||
//this.client.term.rawWrite('\r\n\r\n'); // :TODO: Prob optional based on contents vs text
|
||||
this.client.currentMenuModule.pausePrompt( () => {
|
||||
return cb(null);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return this.client.term.write(pipeToAnsi(`${interruptItem.text}\r\n\r\n`, this.client), cb);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue