https://github.com/kamleshchandnani/walky-talky
EventListeners can easily go out of hand if not used with utmost care, walky-talky is a tiny JS library to create a message channel using Publish/Subscribe pattern.
https://github.com/kamleshchandnani/walky-talky
communicate connect eventbus message pubsub utils
Last synced: 4 months ago
JSON representation
EventListeners can easily go out of hand if not used with utmost care, walky-talky is a tiny JS library to create a message channel using Publish/Subscribe pattern.
- Host: GitHub
- URL: https://github.com/kamleshchandnani/walky-talky
- Owner: kamleshchandnani
- Created: 2018-01-09T05:47:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-09T09:11:10.000Z (over 7 years ago)
- Last Synced: 2025-01-06T12:07:12.563Z (4 months ago)
- Topics: communicate, connect, eventbus, message, pubsub, utils
- Language: JavaScript
- Homepage:
- Size: 42 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# walky-talky
![]()
EventListeners can easily go out of hand if not used with utmost care, walky-talky is a tiny JS library to create a message channel using Publish/Subscribe pattern.
## Purpose
If you ever want to create a channel where anyone can subscribe to the custom action types and associate a custom handler with it, Then based on some event it is published with the action type. The subscriber who had subscribed to this event will get notified and the handler which was associated with it while subscribing will be called with params.This can also act as a communication bridge between two applications.
## Installation
```
yarn add walky-talky
```or
```
npm install walky-talky --save
```## Usage
```js
// module.js
import WalkyTalky from "walky-talky";
actionHandler = dataObject => {
// some logic
};
// subscribe to a custom action type
WalkyTalky.subscribe("ACTION_TYPE", actionHandler);// app.js
import WalkyTalky from "walky-talky";
// publish the action type with the data object
WalkyTalky.publish("ACTION_TYPE", dataObject);
```## Like it?
:star: this repo
## License
MIT © [Kamlesh Chandnani](https://github.com/kamleshchandnani)