the channel object.
event name(s)
event listener
handle with remove
method
// object as event channel
const channel = {};
// connect to event "changed"
on(channel, "changed", (msg)=> console.log(msg));
// it is possible to register to multiple events using ','
on(channel, "changed,click", (msg)=> console.log(msg));
// it is possible to register to any events using '*'
on(channel, "*", (msg)=> console.log(msg));
// on provides handle to unregister
const handle = on(channel, "changed", (msg)=> console.log(msg));
// unregister using "remove"
handle.remove();
Register event listener.