ascor
Version:
一些常用的简单的js工具
42 lines (41 loc) • 875 B
TypeScript
import { EventEmitter } from "./EventEmitter";
interface QueueConfig {
autoStart?: boolean;
workers?: any[];
concurrency?: number;
}
export declare class Queue extends EventEmitter {
workers: any[];
workersCache: any[];
private pending;
private autoStart;
private isRuning;
private isAborted;
private concurrency;
constructor(config?: QueueConfig);
/**
* 获取执行中和队列中的数量,已执行完的不计算在内
*/
get length(): number;
/**
* 添加队列任务
* @param {...any} workers 任务列表
*/
push(...workers: any[]): void;
/**
* 执行下一任务
* @param {*} worker
* @returns
*/
private next;
/**
* 开始任务
*/
start(): void;
/**
* 中止任务
*/
abort(): void;
end(): void;
}
export {};