UNPKG

@towns-protocol/react-sdk

Version:

React Hooks for Towns Protocol SDK

24 lines 1.07 kB
import { type TimelineEvent } from '@towns-protocol/sdk'; import { type ObservableConfig } from './useObservable'; /** * Hook to get the timeline events from a stream. * * You can use the `useTimeline` hook to get the timeline events from a channel stream, dm stream or group dm stream * * @example * ```ts * import { useTimeline } from '@towns-protocol/react-sdk' * import { RiverTimelineEvent } from '@towns-protocol/sdk' * * const { data: events } = useTimeline(streamId) * * // You can filter the events by their kind * const messages = events.filter((event) => event.content?.kind === RiverTimelineEvent.ChannelMessage) * ``` * * @param streamId - The id of the stream to get the timeline events from. * @param config - Configuration options for the observable. * @returns The timeline events of the stream as an observable. */ export declare const useTimeline: (streamId: string, config?: ObservableConfig.FromObservable<TimelineEvent[]>) => import("./useObservable").ObservableValue<TimelineEvent[]>; //# sourceMappingURL=useTimeline.d.ts.map