pubsub - Get-Kraken/fixx GitHub Wiki
(pubsub) Publish-Subscribe pattern: read more on Wikipedia
Use case:
The pubsub pattern can be used to send event driven messages to distributed listeners. For example, if you wanted functions to fire on window resize, a subscription can be created with an associated method. Events can then publish messages to the subscribers of the same name, in this case, window resize.
Available methods:
To create a subscription:
ƒ.subscribe('my-subscription-name', function(){/* do stuff here */});
To unsubscribe a previously created subscription:
ƒ.unsubscribe('my-subscription-name');
To publish to subscribers:
ƒ.publish('my-subscription-name');
[added v1.1.0]