data-cap
    Preparing search index...

    Interface Coordinator

    An isolated coordination domain for dedup and shared subscriptions -- see createCoordinator/defaultCoordinator.

    interface Coordinator {
        acquireSubscription<TEvent>(
            subscribeFn: SubscribeFn<TEvent>,
            handlers: SubscriptionHandlers<TEvent>,
        ): () => void;
        dedupe<TParams, TResult>(
            fn: (params: TParams, signal: AbortSignal) => Promise<TResult>,
            params: TParams,
            signal: AbortSignal,
        ): Promise<TResult>;
    }
    Index
    • Deduplicates concurrent calls to fn (by its own identity) with canonically-equal params. Non-canonicalizable params (or a non-canonicalizable-adjacent failure) simply never dedupe -- fn runs fresh every time, never throwing and never silently colliding two unrelated calls onto one shared promise.

      Each caller's own signal only affects THEIR OWN wait -- aborting it rejects this call's returned promise without affecting the shared underlying execution or any other caller sharing it.

      Type Parameters

      • TParams
      • TResult

      Parameters

      Returns Promise<TResult>