From ee1750c23c1e40c2c1cb4f7e33f622ea86e84ef8 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Tue, 6 Sep 2022 21:27:14 +0200 Subject: xP: clean up --- xP/public/xP.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'xP/public') diff --git a/xP/public/xP.js b/xP/public/xP.js index 46b567a..af20c2b 100644 --- a/xP/public/xP.js +++ b/xP/public/xP.js @@ -171,8 +171,9 @@ rpc.addEventListener('BufferActivate', event => { rpc.addEventListener('BufferLine', event => { let e = event.detail, b = buffers.get(e.bufferName) - if (b !== undefined) - b.lines.push({when: e.when, rendition: e.rendition, items: e.items}) + if (b === undefined) + return + b.lines.push({when: e.when, rendition: e.rendition, items: e.items}) }) rpc.addEventListener('BufferClear', event => { @@ -204,11 +205,11 @@ function applyColor(fg, bg, inverse) { if (inverse) [fg, bg] = [bg >= 0 ? bg : 15, fg >= 0 ? fg : 0] - let style = '' + let style = {} if (fg >= 0) - style += `color: ${palette[fg]};` + style.color = palette[fg] if (bg >= 0) - style += `background-color: ${palette[bg]};` + style.backgroundColor = palette[bg] if (style) return style } @@ -399,9 +400,4 @@ let Main = { }, } -// TODO: Buffer names should work as routes. -window.addEventListener('load', () => { - m.route(document.body, '/', { - '/': Main, - }) -}) +window.addEventListener('load', () => m.mount(document.body, Main)) -- cgit v1.2.3-70-g09d2