@mathquis/node-assistant-protocol
Version:
Assistant protocol decorator for Hermes protocol
16 lines • 387 B
JavaScript
module.exports = (hermes, logger) => {
return (topic, object) => {
return {
...object,
muteChanged: async (siteId, muted) => {
logger.debug('%s muted on site "%s" changed to %s', object.name, siteId, muted)
await hermes.publish(topic, hermes.serialize({
siteId, muted
}))
},
onMuteChanged: (handler) => {
return hermes.on(topic, handler)
}
}
}
}