@v1nt1248/3nclient-lib 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui3n-utils.js
CHANGED
|
@@ -864,9 +864,9 @@ class IE {
|
|
|
864
864
|
return this.arrayOfTasks.shift();
|
|
865
865
|
}
|
|
866
866
|
addTask(C) {
|
|
867
|
-
this.arrayOfTasks.push(C), !(this.numberOfRunners >= this.maxNumberOfRunners) && this.sequenceRunner(this.nextTask);
|
|
867
|
+
this.arrayOfTasks.push(C), !(this.numberOfRunners >= this.maxNumberOfRunners) && this.sequenceRunner(this.nextTask.bind(this));
|
|
868
868
|
}
|
|
869
|
-
|
|
869
|
+
cancelTasks() {
|
|
870
870
|
this.arrayOfTasks = [];
|
|
871
871
|
}
|
|
872
872
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export type Task = () => Promise<void>;
|
|
2
|
-
export
|
|
2
|
+
export interface TaskRunnerInstance {
|
|
3
|
+
addTask: (task: Task) => void;
|
|
4
|
+
cancelTasks: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare class TaskRunner implements TaskRunnerInstance {
|
|
3
7
|
private readonly maxNumberOfRunners;
|
|
4
8
|
private arrayOfTasks;
|
|
5
9
|
private numberOfRunners;
|
|
6
|
-
constructor(maxNumberOfRunners
|
|
10
|
+
constructor(maxNumberOfRunners?: number | undefined);
|
|
7
11
|
private sequenceRunner;
|
|
8
12
|
private nextTask;
|
|
9
13
|
addTask(task: Task): void;
|
|
10
|
-
|
|
14
|
+
cancelTasks(): void;
|
|
11
15
|
}
|