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