@cherrypulp/pubsub

0.0.2 • Public • Published

PubSub

codebeat badge Issues License npm version

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

License

This project is licensed under the MIT License - see the LICENSE file for details.

Package Sidebar

Install

npm i @cherrypulp/pubsub

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

6.7 kB

Total Files

8

Last publish

Collaborators

  • dbennani_cherry
  • danielsum
  • cherrypulpcom
  • monkeymonk
  • anthonypauwels