1.0.0 • Published 6 years ago

walky-talky v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

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.

Installation

yarn add walky-talky

or

npm install walky-talky --save

Usage

// 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