From a5aa536f89f13800772fbb51e21db8294c0adadb Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Sun, 8 Oct 2017 14:07:55 +0200 Subject: [PATCH] =?UTF-8?q?ScreenParser=20is=20now=20standalone=E2=80=A6-a?= =?UTF-8?q?ble!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/term/screen.js | 6 +++++- js/term/screen_parser.js | 18 +++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/js/term/screen.js b/js/term/screen.js index 0d6557a..b482bd9 100644 --- a/js/term/screen.js +++ b/js/term/screen.js @@ -13,7 +13,7 @@ module.exports = class TermScreen extends EventEmitter { this.canvas = mk('canvas') this.ctx = this.canvas.getContext('2d') - this.parser = new ScreenParser(this) + this.parser = new ScreenParser() this.renderer = new ScreenRenderer(this) // debug screen handle @@ -737,6 +737,10 @@ module.exports = class TermScreen extends EventEmitter { this.emit('TEMP:hide-load-failed-msg') break + case 'notification': + this.showNotification(update.content) + break + default: console.log('Unhandled update', update) } diff --git a/js/term/screen_parser.js b/js/term/screen_parser.js index a80fbd9..c08ec1b 100644 --- a/js/term/screen_parser.js +++ b/js/term/screen_parser.js @@ -52,17 +52,7 @@ const OPT_REVERSE_VIDEO = (1 << 14) /* eslint-enable no-multi-spaces */ module.exports = class ScreenParser { - constructor (screen) { - // this.screen = screen - let didWarn = false - Object.defineProperty(this, 'screen', { - get () { - if (!didWarn) console.warn('Deprecated get ScreenParser#screen') - didWarn = true - return screen - } - }) - + constructor () { // true if full content was loaded this.contentLoaded = false } @@ -361,8 +351,10 @@ module.exports = class ScreenParser { break case 'G': - this.screen.showNotification(content) - break + return [{ + topic: 'notification', + content + }] default: console.warn(`Bad data message type; ignoring.\n${JSON.stringify(message)}`)