0.0.1 • Published 7 years ago

pubb v0.0.1

Weekly downloads
2
License
ISC
Repository
-
Last release
7 years ago

Import module in your project:

import pubb from 'pubb'

Create pubb instance:

const events = pubb();

Create functions:

const func1 = str => console.log(`func1: ${str} >.<`);
const func2 = str => console.log(`func2: ${str} :D`);

Subscribe to your functions:

const unsub1 = events.sub(func1);
const unsub2 = events.sub(func2);

Publish data:

events.pub("foo");

Unsubscribe:

unsub1();

Destroy all subscriptions:

events.destroy();

Have fun!