@amityco/ts-sdk-react-native
Version:
Amity Social Cloud Typescript SDK
21 lines (19 loc) • 657 B
text/typescript
import SessionWatcher from '~/client/utils/SessionWatcher';
/**
* ```js
* import { onSessionStateChange } from '@amityco/ts-sdk-react-native'
* const dispose = onSessionStateChange((state: Amity.SessionStates) => {
* // ...
* })
* ```
*
* Fired when any {@link Amity.Client} has a session state change
*
* @param callback The function to call when the event was fired
* @returns an {@link Amity.Unsubscriber} function to stop listening
*
* @category Client Events
*/
export const onSessionStateChange = (
callback: Amity.Listener<Amity.SessionStates>,
): Amity.Unsubscriber => SessionWatcher.getInstance().onSessionStateChange(callback);