ipfs-http-client
Version:
A client library for the IPFS HTTP API
29 lines • 1.06 kB
TypeScript
/**
* @typedef {import('ipfs-core-types/src/pubsub').MessageHandlerFn} MessageHandlerFn
*
* @typedef {Object} Subscription
* @property {MessageHandlerFn} handler
* @property {AbortController} controller
*/
export class SubscriptionTracker {
/** @type {Map<string, Subscription[]>} */
_subs: Map<string, Subscription[]>;
/**
* @param {string} topic
* @param {MessageHandlerFn} handler
* @param {AbortSignal} [signal]
*/
subscribe(topic: string, handler: MessageHandlerFn, signal?: AbortSignal | undefined): AbortSignal;
/**
* @param {string} topic
* @param {MessageHandlerFn} [handler]
*/
unsubscribe(topic: string, handler?: import("ipfs-core-types/src/pubsub").MessageHandlerFn | undefined): void;
}
export type MessageHandlerFn = import('ipfs-core-types/src/pubsub').MessageHandlerFn;
export type Subscription = {
handler: MessageHandlerFn;
controller: AbortController;
};
import { AbortController } from "native-abort-controller";
//# sourceMappingURL=subscription-tracker.d.ts.map