@code-essentials/utils 1.1.1 → 1.1.2

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/barrier.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare class Barrier<T = any> implements PromiseLike<T[]>, AsyncDisposab
7
7
  #private;
8
8
  readonly queue: EnqueuedTask<T>[];
9
9
  await(...asyncTasks: PromiseLike<T>[]): void;
10
- run(...asyncTasks: PromiseLike<T>[]): void;
10
+ run(...asyncFunctions: (() => PromiseLike<T>)[]): void;
11
11
  clear(): void;
12
12
  complete(): Promise<this>;
13
13
  [Symbol.asyncDispose](): Promise<void>;
package/dist/barrier.js CHANGED
@@ -2,16 +2,17 @@ import { AsyncVariable } from "./async-variable.js";
2
2
  export class Barrier {
3
3
  queue = [];
4
4
  await(...asyncTasks) {
5
- this.run(...asyncTasks);
5
+ for (const asyncTask of asyncTasks)
6
+ this.#run(asyncTask);
6
7
  }
7
8
  async #run(task) {
8
9
  const completion = new AsyncVariable();
9
10
  this.queue.push({ task, completion });
10
11
  completion.writeResult(task);
11
12
  }
12
- run(...asyncTasks) {
13
- for (const task of asyncTasks)
14
- this.#run(task);
13
+ run(...asyncFunctions) {
14
+ for (const func of asyncFunctions)
15
+ this.#run(func());
15
16
  }
16
17
  clear() {
17
18
  this.queue.splice(0, this.queue.length);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-essentials/utils",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",