From f5bbb604682346e2418c80b4c2293545877ad5b7 Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Sun, 8 Oct 2017 14:23:05 +0200 Subject: [PATCH] Stop using pointers for button labels --- js/term/buttons.js | 11 ++++++++++- js/term/connection.js | 1 - js/term/index.js | 6 +----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/js/term/buttons.js b/js/term/buttons.js index 32813dd..e8a4cf8 100644 --- a/js/term/buttons.js +++ b/js/term/buttons.js @@ -60,5 +60,14 @@ module.exports = function initButtons (input) { } } - return { update, labels } + return { + update, + get labels () { + return labels + }, + set labels (value) { + labels = value + update() + } + } } diff --git a/js/term/connection.js b/js/term/connection.js index 5e2c360..d1c9ed4 100644 --- a/js/term/connection.js +++ b/js/term/connection.js @@ -145,7 +145,6 @@ module.exports = class TermConnection extends EventEmitter { return true // Simulate success } if (this.xoff) { - // TODO queue console.log("Can't send, flood control. Queueing") this.queue.push(message) return false diff --git a/js/term/index.js b/js/term/index.js index 0bbabaa..15d17ce 100644 --- a/js/term/index.js +++ b/js/term/index.js @@ -20,11 +20,7 @@ module.exports = function (opts) { input.termUpload = termUpload const buttons = initButtons(input) - screen.on('button-labels', labels => { - // TODO: don't use pointers for this - buttons.labels.splice(0, buttons.labels.length, ...labels) - buttons.update() - }) + screen.on('button-labels', labels => { buttons.labels = labels }) screen.on('TEMP:hide-load-failed-msg', () => { let scr = qs('#screen')