Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.
jiajunGit edited this page Jul 24, 2017 · 5 revisions

Events in Git Labels

Git Labels uses an event driven approach for the interactions and sharing of data among the different components to reduce coupling. It primarily uses PubSubJS - https://github.com/mroderick/PubSubJS for handling its events. Below are some code examples that demonstrate how to use PubSubJS to publish and subscribe to events:

Publishing events asynchronously

PubSub.publish("group-label/unselect-item", {itemID: itemID} );

Publishing events synchronously

PubSub.publishSync("group-label/unselect-item", {itemID: itemID} );

Subscribing to events

PubSub.subscribe("side-bar-ui/update-data", this.handleDestroyedEvent.bind(this) );

Learn more

To learn more about PubSubJS, you can visit https://github.com/mroderick/PubSubJS