The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
691 B

module.exports = class {
onCreate(input) {
this.state = {
channels: input.channels,
modal: null,
}
}
open(modal) {
this.state.modal = modal
}
close() {
this.state.modal = null
}
channelEdited(channel, patch) {
const channels = this.state.channels.slice()
const index = channels.findIndex(c => c.name === channel.name)
if (index === -1) {
return
}
channels[index] = Object.assign({}, channels[index], patch)
this.state.channels = channels
console.log(channels[index])
}
channelAdded(channel) {
this.state.channels = this.state.channels.concat(channel).sort((a,b) => a.name.localeCompare(b.name))
}
}