A simplified implementation to learn how to build our own pubsub (publisher-subscriber pattern).
source code: [build-pubsub]
$ npm install build-pubsub
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