reneos.pubsub
install
npm i @reneos/pubsub --save
https://www.npmjs.com/package/@reneos/pubsub
This package is intended for messaging through a publication (shared bus). Channels have a tree structure and publishing in an inherited channel makes publishing in the parent channel.
const {PubSub} = import "@reneos/pubsub"
To subscribe to events, use :
const key = PubSub.Subscribe("my.path.sub",(data,path)=>{
console.log(`On Publicate ${data.anyprop} `)
})
A subscription with an empty path will receive all events
To publish events, use :
PubSub.Publish("my.path",{anyprop:'anydata'})