browser-debugger-cli
Version:
DevTools telemetry in your terminal. For humans and agents. Direct WebSocket to Chrome's debugging port.
54 lines • 1.43 kB
TypeScript
/**
* Custom concurrency limiter for controlling parallel async operations.
*/
/**
* Limits the number of concurrent async operations.
*
* @example
* ```typescript
* const limiter = new ConcurrencyLimiter(5);
* const results = await Promise.all(
* tasks.map(task => limiter.run(() => performTask(task)))
* );
* ```
*/
export declare class ConcurrencyLimiter {
private readonly limit;
private running;
private queue;
/**
* Creates a new concurrency limiter.
*
* @param limit - Maximum number of concurrent operations
*/
constructor(limit: number);
/**
* Executes an async function with concurrency control.
*
* @param fn - Async function to execute
* @returns Promise resolving to the function's result
*
* @example
* ```typescript
* const limiter = new ConcurrencyLimiter(3);
* const result = await limiter.run(async () => {
* const response = await fetch(url);
* return response.json();
* });
* ```
*/
run<T>(fn: () => Promise<T>): Promise<T>;
/**
* Gets the current number of running operations.
*
* @returns Number of currently executing operations
*/
getRunningCount(): number;
/**
* Gets the current queue size.
*
* @returns Number of operations waiting to execute
*/
getQueueSize(): number;
}
//# sourceMappingURL=concurrency.d.ts.map