Listen for events in the xkit.js library
Parameters
event
:'config:update' | 'connection:enable' | 'connection:remove' | 'connection:disable'
The type of event to subscribe to messages forfn
:(payload: unknown) => void
A function to be called when the event is triggered, with a payload specific to the event.
Returns
void
xkit.on('connection:enable', () => console.log('connection enabled!'))
xkit.js allows consumers to subscribe to certain events in the library. This can be particularly useful if you are using xkit.js via xkit-catalog.js where you do not control the full lifecycle of connections.
Events available:
Event Name | Payload | Description |
---|---|---|
config:update | xkit.js keeps the user's logged in state. When that state changes (e.g. when a user is logged in or out), this event will fire. | |
connection:enable | Connection | When a user connects or reconnects, this event will be fired with the updated connection object. |
connection:remove | Connection | When a user removes a connection, this event will be fired with the connection object before it was removed. |
connection:disable DEPRECATED | string | When a user removes a connection, this event will be fired with the slug of the Connector that was removed. DEPRECATED: prefer connection:remove |