xP: clean up

This commit is contained in:
Přemysl Eric Janouch 2022-09-06 21:27:14 +02:00
parent f5104c807d
commit ee1750c23c
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -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))