Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

sevilyilmaz/pubsub

Repository files navigation

Cachable Pub/Sub Codeship Status for sevilyilmaz/pubsub Code Climate Test Coverage

Pub/Sub library that keeps historical data. It's possible to publish before subscription then subscribe and get the data that was published.

Usage

Subscription

pubsub.sub([ID], callback);
pubsub.sub('lorem', (data) => data);

Publish

pubsub.pub([ID], data);
pubsub.pub('lorem', 'ipsum');
pubsub.pub('lorem', { data: 'ipsum'});

You may pass multiple arguments to the subscription.

pubsub.pub('lorem', 'ipsum', 'dolor');

Unsubscribe

To unsubscribe from all subscriptions that has the ID "lorem".

pubsub.unsub('lorem');

To unsubscribe from only one subscription that has the ID "lorem".

pubsub.unsub('lorem', callback);

About

Pub/Sub library that keeps historical data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published