church_streamer/app/page_status.js

31 lines
568 B
JavaScript
Raw Normal View History

2024-02-13 23:54:45 +00:00
const m = require('mithril')
const client = require('./api/client')
const Status = {
oninit: function(vnode) {
client.registerComponent(this)
},
onremove: function(vnode) {
client.unregisterComponent(this)
},
ioInit: function() {
client.on(this, 'encoder.status', status => {
console.log('status', status)
})
},
ioConnected: function() {
client.emit('encoder.status')
},
view: function(vnode) {
return [
m('div', `Hello world, connection status: ${client.isConnected}`),
]
},
}
module.exports = Status