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' } })