@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
33 lines (32 loc) • 865 B
TypeScript
/**
* @module Async
*/
import type { TimeSpan } from "../../../utilities/_module-exports.js";
import { type InvokableFn, type Promisable } from "../../../utilities/_module-exports.js";
/**
* @internal
*/
export type PromiseQueueSettings = {
maxConcurrency: number;
maxCapacity: number | null;
interval: TimeSpan;
};
/**
* @internal
*/
export declare class PromiseQueue {
private readonly settings;
private readonly queue;
private readonly listeners;
constructor(settings: PromiseQueueSettings);
private start;
private getItems;
private process;
private enqueue;
private listenOnce;
private asPromise;
/**
* @throws {CapacityFullAsyncError} {@link CapacityFullAsyncError}
*/
add<TValue>(func: InvokableFn<[signal: AbortSignal], Promisable<TValue>>, signal: AbortSignal): Promise<TValue>;
}