UNPKG

1.85 kBTypeScriptView Raw
1/// <reference types="node" />
2import { EventEmitter } from 'events';
3import { Operation } from './Operation';
4/**
5 * @class OperationQueue
6 */
7export declare class OperationQueue extends EventEmitter {
8 map: Object;
9 operations: Operation<any>[];
10 resolve: Function;
11 reject: Function;
12 completionCallback: Function;
13 maximumConcurrentOperations: number;
14 readyQueueMap: Object;
15 readyQueue: Object;
16 runningQueueMap: Object;
17 runningQueue: Operation<any>[];
18 queues: Object;
19 promise: Promise<any>;
20 private _paused;
21 private _processedOperations;
22 constructor();
23 /**
24 * Getter
25 * @returns {boolean}
26 */
27 get isExecuting(): boolean;
28 /**
29 * Complete the queue, this will resolve and notify its callback
30 */
31 done(): void;
32 /**
33 * @param {Operation} operation
34 */
35 addOperation(operation: Operation<any>): Promise<any>;
36 /**
37 * @param {Array.<Operation>} operations
38 */
39 addOperations(operations: Operation<any>[]): Promise<any>;
40 /**
41 * Pauses the queue, no new operations will be added to the queue
42 */
43 pause(): void;
44 /**
45 * Resumes the queue from an paused state
46 */
47 resume(): void;
48 /**
49 * Getter
50 * @returns {boolean}
51 */
52 get isPaused(): boolean;
53 private _preProcessOperations;
54 private _bindOperation;
55 private _unbindOperation;
56 private _begin;
57 private _startOperations;
58 private _startOperation;
59 private _onOperationStart;
60 private _onOperationReady;
61 private _onOperationDone;
62 private _checkNextOperation;
63 /**
64 * @returns {boolean}
65 */
66 hasOperations(): boolean;
67 /**
68 * Returns the next operation to be executed
69 *
70 * @returns {?Operation}
71 */
72 getNextOperation(): Operation<any>;
73 private _onOperationCancel;
74}