1.0.1 • Published 5 years ago
encore-publish-subscribe-service v1.0.1
Encore Pub/Sub Service
Publisher/Subscriber class that allows us connect applications or modules inside application
Install
$ npm install encore-publish-subscribe-service
Usage
1) Import Pub/Sub class 2) Create an instance, using application name 3) Use Encore Pub/Sub instance
Documentation
Library is working with special event format: {widget name}_{view name}_{event name} View name could be empty. Widget and event names should use dash as a word separator.
Service provide two groups of connection methods and one helper method for event name generation:
Publish methods
emit - call event on specific HTML element globalEmit - call event on window
Subscribe methods
subscribe - listen to event on specific HTML element, return unsubscribe function globalSubscribe - listen to event on window
Helper method
getEventName - return formatted event name