Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pajaydev/build-own-pubsub
A simplified implementation to learn how to build our own pubsub (publisher-subscriber pattern)
https://github.com/pajaydev/build-own-pubsub
build-pubsub build-your-own-pubsub event-emitter learn-pubsub listener publisher publisher-subscriber publisher-subscriber-pattern pubsub topic write-your-own-pubsub
Last synced: about 4 hours ago
JSON representation
A simplified implementation to learn how to build our own pubsub (publisher-subscriber pattern)
- Host: GitHub
- URL: https://github.com/pajaydev/build-own-pubsub
- Owner: pajaydev
- Created: 2019-08-25T22:40:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T23:39:51.000Z (about 2 years ago)
- Last Synced: 2024-10-15T04:33:08.885Z (3 months ago)
- Topics: build-pubsub, build-your-own-pubsub, event-emitter, learn-pubsub, listener, publisher, publisher-subscriber, publisher-subscriber-pattern, pubsub, topic, write-your-own-pubsub
- Language: JavaScript
- Homepage:
- Size: 222 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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
```sh
$ npm install build-pubsub
```### how to use
```js
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.- [Publisher subscriber pattern](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern)
- [Observer vs pubsub pattern](https://hackernoon.com/observer-vs-pub-sub-pattern-50d3b27f838c)
- [Enterprise integeration patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/PublishSubscribeChannel.html)
- [What is pubsub](https://blog.stackpath.com/pub-sub/)