IdentityEventbus
Identity event bus
Allows consumers to subscribe to generic events that may be interpreted to trigger specific calls. Events are dispatched when the IdentityEventbus#track method is called by implementors of the SDK.
Example:
const analytics = new IdentityEventbus({name: 'analytics'});
const unsubscribe = analytics.subscribe((event) => {
{ eventType = 'track', eventName, timestamp, properties = {} } = event;
// interpret and send to analytics platform
});
// to stop observing at a later time:
unsubscribe();
// to dispatch an analytics event (by SDK implementors):
analytics.track('page_view', { foo: 'bar' });
Constructor Summary
| Public Constructor | ||
| public |
constructor(options: Object) IdentityEventbus constructor |
|
Method Summary
| Public Methods | ||
| public |
Subscribes a callback to receive all events. |
|
| public |
Adds a generic event to the event queue and publishes it to all subscribers |
|
Manual
Reference
Source
Test
