From 9c4027d2d1a42f4e94a45f7302fb3032fc4709f6 Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Sun, 24 Sep 2017 17:41:53 +0200 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=9CWaiting=20for=20content=E2=80=9D?= =?UTF-8?q?=20screen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/term/connection.js | 1 + js/term/index.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/js/term/connection.js b/js/term/connection.js index 8687adc..10a63ea 100644 --- a/js/term/connection.js +++ b/js/term/connection.js @@ -80,6 +80,7 @@ module.exports = class TermConnection extends EventEmitter { break default: + this.emit('load') this.screen.load(evt.data) if (!this.pageShown) { window.showPage() diff --git a/js/term/index.js b/js/term/index.js index 2ccc142..3a7a6c1 100644 --- a/js/term/index.js +++ b/js/term/index.js @@ -25,11 +25,18 @@ module.exports = function (opts) { }) conn.on('connect', () => { clearTimeout(showConnectingTimeout) - screen.window.statusScreen = null + screen.window.statusScreen = { title: 'Waiting for content', loading: true } + }) + conn.on('load', () => { + if (screen.window.statusScreen) screen.window.statusScreen = null }) conn.on('disconnect', () => { clearTimeout(showConnectingTimeout) screen.window.statusScreen = { title: 'Disconnected' } + screen.screen = [] + screen.screenFG = [] + screen.screenBG = [] + screen.screenAttrs = [] }) conn.on('silence', () => { screen.window.statusScreen = { title: 'Waiting for server', loading: true } }) // conn.on('ping-fail', () => { screen.window.statusScreen = { title: 'Disconnected' } })