@amityco/ts-sdk-react-native
Version:
Amity Social Cloud Typescript SDK
34 lines (30 loc) • 898 B
text/typescript
import { createEventSubscriber } from '~/core/events';
import { getActiveClient } from '~/client/api/activeClient';
/**
* ```js
* import { onLocalInvitationDeleted } from '@amityco/ts-sdk'
* const dispose = onLocalInvitationDeleted(data => {
* // ...
* })
* ```
*
* Fired when an {@link Amity.InvitationPayload} has been deleted
*
* @param callback The function to call when the event was fired
* @returns an {@link Amity.Unsubscriber} function to stop listening
*
* @category Invitation Events
*/
export const onLocalInvitationDeleted = (
callback: Amity.Listener<Amity.InternalInvitation[]>,
): Amity.Unsubscriber => {
const client = getActiveClient();
const disposers = [
createEventSubscriber(client, 'onLocalInvitationDeleted', 'local.invitation.deleted', payload =>
callback(payload),
),
];
return () => {
disposers.forEach(fn => fn());
};
};