npm.io
0.0.1 • Published 9 years ago

pubb

Licence
ISC
Version
0.0.1
Deps
0
Vulns
0
Weekly
0

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!

Keywords