@nuskin/events
"This is a replacement for the pub/sub functionality that has been used from nuskinjquery.
It includes the same functionality as what was there and the main use of this is in @nuskin/ns-util - events.js
where nuskinjquery was used."
Installing
Usng npm:
npm add @nuskin/events
Usng yarn:
yarn add @nuskin/events
Example usage
const {
subscribe,
publish,
unsubscribe,
getValue,
setValue,
} = require('@nuskin/events');
publish(eventId, value);
const testCallback = (value) => {
};
subscribe(eventId, testCallback);
unsubscribe(eventId, testCallback);
setValue(eventId, value);
getValue(eventId, testCallback, true);
Resources
License
MIT