aboutsummaryrefslogtreecommitdiff
path: root/xP
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-06 21:27:14 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-06 22:33:00 +0200
commitee1750c23c1e40c2c1cb4f7e33f622ea86e84ef8 (patch)
treeb1166dafc01fc0aaec770eef41b843652094dbba /xP
parentf5104c807dd749697f26c6d5e5c31ac981a19634 (diff)
downloadxK-ee1750c23c1e40c2c1cb4f7e33f622ea86e84ef8.tar.gz
xK-ee1750c23c1e40c2c1cb4f7e33f622ea86e84ef8.tar.xz
xK-ee1750c23c1e40c2c1cb4f7e33f622ea86e84ef8.zip
xP: clean up
Diffstat (limited to 'xP')
-rw-r--r--xP/public/xP.js18
1 files changed, 7 insertions, 11 deletions
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))