PubSub
PubSub helper.
Installation
npm install @cherrypulp/pubsub
Quick start
import * as event from '@cherrypulp/pubsub';
// or
import {emit, off, on, once} from '@cherrypulp/pubsub';
Methods
emit
Publish to the given channel.
emit('channel', args);
off
Remove the given subscriber.
off('channel');
on
Subscribe to a new or existing channel.
on('channel', () => console.log('foo'));
once
Subscribe to a new or existing channel and remove the subscriber when published.
once('channel', () => console.log('bar'));
Versioning
Versioned using SemVer.
Contribution
Please raise an issue if you find any. Pull requests are welcome!
Author
- Stéphan Zych - monkeymonk
License
This project is licensed under the MIT License - see the LICENSE file for details.