sequential-task-queue
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -37,5 +37,3 @@ "use strict"; | ||
this.name = options.name || "SequentialTaskQueue"; | ||
this.scheduler = options.scheduler || { | ||
schedule: cb => setTimeout(cb, 0) | ||
}; | ||
this.scheduler = options.scheduler || SequentialTaskQueue.defaultScheduler; | ||
} | ||
@@ -217,2 +215,5 @@ /** Indicates if the queue has been closed. Calling {@link SequentialTaskQueue#push} on a closed queue will result in an exception. */ | ||
} | ||
SequentialTaskQueue.defaultScheduler = { | ||
schedule: callback => setTimeout(callback, 0) | ||
}; | ||
exports.SequentialTaskQueue = SequentialTaskQueue; | ||
@@ -224,3 +225,8 @@ function noop() { | ||
} | ||
SequentialTaskQueue.defaultScheduler = { | ||
schedule: typeof setImmediate === "function" | ||
? callback => setImmediate(callback) | ||
: callback => setTimeout(callback, 0) | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlcXVlbnRpYWwtdGFzay1xdWV1ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBdUVBOzs7O0dBSUc7QUFDUSxnQ0FBd0IsR0FBRztJQUNsQyxtR0FBbUc7SUFDbkcsTUFBTSxFQUFFLE1BQU0sQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDO0lBQzNCLG9FQUFvRTtJQUNwRSxPQUFPLEVBQUUsTUFBTSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUM7Q0FDL0IsQ0FBQTtBQUVEOztHQUVHO0FBQ1EsaUNBQXlCLEdBQUc7SUFDbkMsT0FBTyxFQUFFLFNBQVM7SUFDbEIsS0FBSyxFQUFFLE9BQU87SUFDZCxPQUFPLEVBQUUsU0FBUztDQUNyQixDQUFBO0FBRUQ7O0dBRUc7QUFDSDtJQWlCSTs7O01BR0U7SUFDRixZQUFZLE9BQTBCO1FBbkI5QixVQUFLLEdBQWdCLEVBQUUsQ0FBQztRQUN4QixjQUFT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2VsZiBhcyB0aGUgYHRoaXNgIGFyZ3VtZW50IG9mIHRoZSBjYWxsLiBcclxuICAgICAqL1xyXG4gICAgb25jZShldnQ6IHN0cmluZywgaGFuZGxlcjogRnVuY3Rpb24pIHtcclxuICAgICAgICB2YXIgY2IgPSAoLi4uYXJnczogYW55W10pID0+IHtcclxuICAgICAgICAgICAgdGhpcy5vZmYoZXZ0LCBjYik7XHJcbiAgICAgICAgICAgIGhhbmRsZXIuYXBwbHkodGhpcywgYXJncyk7XHJcbiAgICAgICAgfTtcclxuICAgICAgICB0aGlzLm9uKGV2dCwgY2IpO1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmVtb3ZlcyBhbiBldmVudCBoYW5kbGVyLlxyXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IGV2dCAtIEV2ZW50IG5hbWVcclxuICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGhhbmRsZXIgLSBFdmVudCBoYW5kbGVyIHRvIGJlIHJlbW92ZWRcclxuICAgICAqL1xyXG4gICAgb2ZmKGV2dDogc3RyaW5nLCBoYW5kbGVyOiBGdW5jdGlvbikge1xyXG4gICAgICAgIGlmICh0aGlzLmV2ZW50cykge1xyXG4gICAgICAgICAgICB2YXIgbGlzdCA9IHRoaXMuZXZlbnRzW2V2dF07XHJcbiAgICAgICAgICAgIGlmIChsaXN0KSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgaSA9IDA7XHJcbiAgICAgICAgICAgICAgICB3aGlsZSAoaSA8IGxpc3QubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxpc3RbaV0gPT09IGhhbmRsZXIpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3Quc3BsaWNlKGksIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgaSsrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIHByaXZhdGUgZW1pdChldnQ6IHN0cmluZywgLi4uYXJnczogYW55W10pIHtcclxuICAgICAgICBpZiAodGhpcy5ldmVudHMgJiYgdGhpcy5ldmVudHNbZXZ0XSlcclxuICAgICAgICAgICAgdHJ5IHsgXHJcbiAgICAgICAgICAgICAgICB0aGlzLmV2ZW50c1tldnRdLmZvckVhY2goZm4gPT4gZm4uYXBwbHkodGhpcywgYXJncykpO1xyXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XHJcbiAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKGAke3RoaXMubmFtZX06IEV4Y2VwdGlvbiBpbiAnJHtldnR9JyBldmVudCBoYW5kbGVyYCwgZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgIH1cclxuXHJcbiAgICBwcml2YXRlIG5leHQoKSB7XHJcbiAgICAgICAgLy8gVHJ5IHJ1bm5pbmcgdGhlIG5leHQgdGFzaywgaWYgbm90IGN1cnJlbnRseSBydW5uaW5nIG9uZSBcclxuICAgICAgICBpZiAoIXRoaXMuY3VycmVudFRhc2spIHtcclxuICAgICAgICAgICAgdmFyIHRhc2sgPSB0aGlzLnF1ZXVlLnNoaWZ0KCk7XHJcbiAgICAgICAgICAgIC8vIHNraXAgY2FuY2VsbGVkIHRhc2tzXHJcbiAgICAgICAgICAgIHdoaWxlICh0YXNrICYmIHRhc2suY2FuY2VsbGF0aW9uVG9rZW4uY2FuY2VsbGVkKVxyXG4gICAgICAgICAgICAgICAgdGFzayA9IHRoaXMucXVldWUuc2hpZnQoKTtcclxuICAgICAgICAgICAgaWYgKHRhc2spIHtcclxuICAgICAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jdXJyZW50VGFzayA9IHRhc2s7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRhc2sudGltZW91dCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YXNrLnRpbWVvdXRIYW5kbGUgPSBzZXRUaW1lb3V0KFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKCkgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZW1pdChzZXF1ZW50aWFsVGFza1F1ZXVlRXZlbnRzLnRpbWVvdXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FuY2VsVGFzayh0YXNrLCBjYW5jZWxsYXRpb25Ub2tlblJlYXNvbnMudGltZW91dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhc2sudGltZW91dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGxldCByZXMgPSB0YXNrLmNhbGxiYWNrLmFwcGx5KHVuZGVmaW5lZCwgdGFzay5hcmdzKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAocmVzICYmIGlzUHJvbWlzZShyZXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcy50aGVuKCgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRvbmVUYXNrKHRhc2spO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kb25lVGFzayh0YXNrLCBlcnIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZG9uZVRhc2sodGFzayk7XHJcblxyXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZG9uZVRhc2sodGFzaywg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WVFdmVudHMuZHJhaW5lZCk7XHJcbiAgICAgICAgICAgICAgICB0aGlzLmNhbGxXYWl0ZXJzKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgdGhpcy5zY2hlZHVsZXIuc2NoZWR1bGUoKCkgPT4gdGhpcy5uZXh0KCkpO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcbiAgICBwcml2YXRlIGNhbGxXYWl0ZXJzKCkge1xyXG4gICAgICAgIGxldCB3YWl0ZXJzID0gdGhpcy53YWl0ZXJzLnNwbGljZSgwKTtcclxuICAgICAgICB3YWl0ZXJzLmZvckVhY2god2FpdGVyID0+IHdhaXRlcigpKTtcclxuICAgIH1cclxufVxyXG5cclxuaW50ZXJmYWNlIFRhc2tFbnRyeSB7XHJcbiAgICBhcmdzOiBhbnlbXTtcclxuICAgIGNhbGxiYWNrOiBGdW5jdGlvbjtcclxuICAgIHRpbWVvdXQ/OiBudW1iZXI7XHJcbiAgICB0aW1lb3V0SGFuZGxlPzogYW55O1xyXG4gICAgY2FuY2VsbGF0aW9uVG9rZW46IENhbmNlbGxhdGlvblRva2VuO1xyXG59XHJcblxyXG5mdW5jdGlvbiBub29wKCkge1xyXG59XHJcblxyXG5mdW5jdGlvbiBpc1Byb21pc2Uob2JqOiBhbnkpOiBvYmogaXMgUHJvbWlzZUxpa2U8YW55PiB7XHJcbiAgICByZXR1cm4gKG9iaiAmJiB0eXBlb2Ygb2JqLnRoZW4gPT09IFwiZnVuY3Rpb25cIik7XHJcbn1cclxuXHJcblxyXG5cclxuXHJcblxyXG5cclxuXHJcblxyXG5cclxuXHJcblxyXG5cclxuXHJcblxyXG5cclxuIl0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlcXVlbnRpYWwtdGFzay1xdWV1ZS50cyJdLCJuYW1lcyI6W10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ZXVlIHdpbGwgc2V0IGl0c2VsZiBhcyB0aGUgYHRoaXNgIGFyZ3VtZW50IG9mIHRoZSBjYWxsLiBcclxuICAgICAqL1xyXG4gICAgb25jZShldnQ6IHN0cmluZywgaGFuZGxlcjogRnVuY3Rpb24pIHtcclxuICAgICAgICB2YXIgY2IgPSAoLi4uYXJnczogYW55W10pID0+IHtcclxuICAgICAgICAgICAgdGhpcy5vZmYoZXZ0LCBjYik7XHJcbiAgICAgICAgICAgIGhhbmRsZXIuYXBwbHkodGhpcywgYXJncyk7XHJcbiAgICAgICAgfTtcclxuICAgICAgICB0aGlzLm9uKGV2dCwgY2IpO1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmVtb3ZlcyBhbiBldmVudCBoYW5kbGVyLlxyXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IGV2dCAtIEV2ZW50IG5hbWVcclxuICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGhhbmRsZXIgLSBFdmVudCBoYW5kbGVyIHRvIGJlIHJlbW92ZWRcclxuICAgICAqL1xyXG4gICAgb2ZmKGV2dDogc3RyaW5nLCBoYW5kbGVyOiBGdW5jdGlvbikge1xyXG4gICAgICAgIGlmICh0aGlzLmV2ZW50cykge1xyXG4gICAgICAgICAgICB2YXIgbGlzdCA9IHRoaXMuZXZlbnRzW2V2dF07XHJcbiAgICAgICAgICAgIGlmIChsaXN0KSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgaSA9IDA7XHJcbiAgICAgICAgICAgICAgICB3aGlsZSAoaSA8IGxpc3QubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxpc3RbaV0gPT09IGhhbmRsZXIpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3Quc3BsaWNlKGksIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgaSsrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIHByaXZhdGUgZW1pdChldnQ6IHN0cmluZywgLi4uYXJnczogYW55W10pIHtcclxuICAgICAgICBpZiAodGhpcy5ldmVudHMgJiYgdGhpcy5ldmVudHNbZXZ0XSlcclxuICAgICAgICAgICAgdHJ5IHsgXHJcbiAgICAgICAgICAgICAgICB0aGlzLmV2ZW50c1tldnRdLmZvckVhY2goZm4gPT4gZm4uYXBwbHkodGhpcywgYXJncykpO1xyXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XHJcbiAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKGAke3RoaXMubmFtZX06IEV4Y2VwdGlvbiBpbiAnJHtldnR9JyBldmVudCBoYW5kbGVyYCwgZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgIH1cclxuXHJcbiAgICBwcml2YXRlIG5leHQoKSB7XHJcbiAgICAgICAgLy8gVHJ5IHJ1bm5pbmcgdGhlIG5leHQgdGFzaywgaWYgbm90IGN1cnJlbnRseSBydW5uaW5nIG9uZSBcclxuICAgICAgICBpZiAoIXRoaXMuY3VycmVudFRhc2spIHtcclxuICAgICAgICAgICAgdmFyIHRhc2sgPSB0aGlzLnF1ZXVlLnNoaWZ0KCk7XHJcbiAgICAgICAgICAgIC8vIHNraXAgY2FuY2VsbGVkIHRhc2tzXHJcbiAgICAgICAgICAgIHdoaWxlICh0YXNrICYmIHRhc2suY2FuY2VsbGF0aW9uVG9rZW4uY2FuY2VsbGVkKVxyXG4gICAgICAgICAgICAgICAgdGFzayA9IHRoaXMucXVldWUuc2hpZnQoKTtcclxuICAgICAgICAgICAgaWYgKHRhc2spIHtcclxuICAgICAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jdXJyZW50VGFzayA9IHRhc2s7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRhc2sudGltZW91dCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YXNrLnRpbWVvdXRIYW5kbGUgPSBzZXRUaW1lb3V0KFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKCkgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZW1pdChzZXF1ZW50aWFsVGFza1F1ZXVlRXZlbnRzLnRpbWVvdXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FuY2VsVGFzayh0YXNrLCBjYW5jZWxsYXRpb25Ub2tlblJlYXNvbnMudGltZW91dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhc2sudGltZW91dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGxldCByZXMgPSB0YXNrLmNhbGxiYWNrLmFwcGx5KHVuZGVmaW5lZCwgdGFzay5hcmdzKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAocmVzICYmIGlzUHJvbWlzZShyZXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcy50aGVuKCgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRvbmVUYXNrKHRhc2spO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kb25lVGFzayh0YXNrLCBlcnIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZG9uZVRhc2sodGFzayk7XHJcblxyXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRo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BhbnlbXSkgPT4gdm9pZD5jYWxsYmFjaylcclxuICAgICAgICA6IGNhbGxiYWNrID0+IHNldFRpbWVvdXQoPCguLi5hcmdzOiBhbnlbXSkgPT4gdm9pZD5jYWxsYmFjaywgMClcclxufTtcclxuXHJcblxyXG5cclxuXHJcblxyXG5cclxuXHJcblxyXG5cclxuXHJcblxyXG5cclxuXHJcbiJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ== |
/** | ||
* Represents an object that schedules a function for asynchronous execution. | ||
* The default implementation used by {@link SequentialTaskQueue} calls {@link setTimeout} | ||
* @param { Function } callback: The function that needs to be scheduled. | ||
* | ||
*/ | ||
* The default implementation used by {@link SequentialTaskQueue} calls {@link setImmediate} when available, | ||
* and {@link setTimeout} otherwise. | ||
* @see {@link SequentialTaskQueue.defaultScheduler} | ||
* @see {@link TaskQueueOptions#scheduler} | ||
*/ | ||
export interface Scheduler { | ||
/** | ||
* Schedules a callback for asynchronous execution. | ||
*/ | ||
schedule(callback: Function): void; | ||
@@ -13,3 +17,3 @@ } | ||
*/ | ||
export interface TaskQueueOptions { | ||
export interface SequentialTaskQueueOptions { | ||
/** | ||
@@ -89,2 +93,3 @@ * Assigns a name to the task queue for diagnostic purposes. The name does not need to be unique. | ||
export declare class SequentialTaskQueue { | ||
static defaultScheduler: Scheduler; | ||
private queue; | ||
@@ -104,3 +109,3 @@ private _isClosed; | ||
*/ | ||
constructor(options?: TaskQueueOptions); | ||
constructor(options?: SequentialTaskQueueOptions); | ||
/** | ||
@@ -107,0 +112,0 @@ * Adds a new task to the queue. |
{ | ||
"name": "sequential-task-queue", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "FIFO task queue for node and the browser", | ||
@@ -5,0 +5,0 @@ "author": { |
46715
482