Skip to content

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

Notifications You must be signed in to change notification settings

pajaydev/build-own-pubsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build-pubsub

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

How do I learn?

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.