UNPKG

@sendbird/uikit-react

Version:

Sendbird UIKit for React: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.

23 lines (22 loc) 756 B
export type PubSubTypes<T extends keyof any, U extends { topic: T; payload: any; }> = { __getTopics: () => Record<T, Set<(data: PayloadByTopic<T, U>) => void>>; subscribe: <K extends T>(topic: K, subscriber: (data: PayloadByTopic<K, U>) => void) => { remove: () => void; }; publish: <K extends T>(topic: K, data: PayloadByTopic<K, U>) => void; }; type PayloadByTopic<T extends keyof any, U> = U extends { topic: T; payload: infer P; } ? P : never; type Options = { publishSynchronous?: boolean; }; declare const pubSubFactory: <T extends string | number | symbol = string | number | symbol, U extends { topic: T; payload: any; } = any>(opts?: Options) => PubSubTypes<T, U>; export default pubSubFactory;