@towns-protocol/react-sdk
Version:
React Hooks for Towns Protocol SDK
14 lines • 824 B
TypeScript
import type { Observable, SyncAgent } from '@towns-protocol/sdk';
import { type ObservableConfig } from './useObservable';
type SyncSelector = SyncAgent['observables'];
/**
* Hook to get an observable from the sync agent.
*
* An alternative of our premade hooks, allowing the creation of custom abstractions.
* @param selector - A selector function to get a observable from the sync agent.
* @param config - Configuration options for the observable.
* @returns The data from the selected observable.
*/
export declare function useTowns<T>(selector: (sync: SyncSelector) => Observable<T>, config?: ObservableConfig.FromData<T>): import("./useObservable").ObservableValue<T extends import("@towns-protocol/sdk").PersistedModel<infer UnwrappedData> ? UnwrappedData : T>;
export {};
//# sourceMappingURL=useTowns.d.ts.map