nostr-hooks
Version:
React hooks for developing Nostr clients
23 lines (22 loc) • 1.15 kB
TypeScript
import { CreateSubscriptionParams } from '../../types';
/**
* Custom hook to manage NDK subscriptions.
*
* @param subId - The subscription ID. This is used to identify the subscription internally.
* @returns An object containing the subscription details and methods to manage the subscription.
* @property createSubscription - Function to create a new subscription.
* @property removeSubscription - Function to remove the subscription.
* @property loadMore - Function to load more events for an existing subscription.
* @property isLoading - Boolean indicating if the subscription is currently loading.
*/
export declare const useSubscription: (subId: string | undefined) => {
createSubscription: (params: Omit<CreateSubscriptionParams, "subId">) => import("@nostr-dev-kit/ndk").NDKSubscription | null;
removeSubscription: () => void;
loadMore: (limit?: number, since?: number | null) => void | "" | undefined;
isLoading: boolean;
subscription?: import("@nostr-dev-kit/ndk").NDKSubscription;
events?: import("@nostr-dev-kit/ndk").NDKEvent[];
eose?: boolean;
hasMore?: boolean;
listenersCount?: number;
};