build-pubsub

1.0.1 • Public • Published

build-pubsub Build Status

A simplified implementation to learn how to build our own pubsub (publisher-subscriber pattern).

How do I learn?

The purpose of the project to explain how most of the event emitters (pubsub) works. source code: build-pubsub

Want to try

$ npm install build-pubsub

how to use

const Pubsub = require('build-pubsub');
const pubsub = new Pubsub();
pubsub.on('AJAX', ajaxFunc);
pubsub.on('AJAX', ajaxAnotherFunc);
pubsub.emit('AJAX', args); // fires both ajaxFunc & ajaxAnotherFunc with args

Some of the useful links to learn pubsub.

Contributions

It didn't make sense, let me know how it can be improved by creating issue or PR.

Tests

npm run test

Dependencies (0)

    Dev Dependencies (10)

    Package Sidebar

    Install

    npm i build-pubsub

    Weekly Downloads

    3

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    12.5 kB

    Total Files

    10

    Last publish

    Collaborators

    • pajay