@highoutput/async-group
Advanced tools
Comparing version 0.3.6 to 0.3.8
@@ -7,35 +7,32 @@ "use strict"; | ||
const v4_1 = __importDefault(require("uuid/v4")); | ||
let AsyncGroup = (() => { | ||
class AsyncGroup { | ||
constructor() { | ||
this.promises = new Map(); | ||
class AsyncGroup { | ||
constructor() { | ||
this.promises = new Map(); | ||
} | ||
async add(promise) { | ||
const id = (0, v4_1.default)(); | ||
this.promises.set(id, promise.finally(() => { | ||
this.promises.delete(id); | ||
})); | ||
return promise; | ||
} | ||
async wait() { | ||
while (this.promises.size > 0) { | ||
const promises = Array.from(this.promises.values()); | ||
this.promises.clear(); | ||
await Promise.all(promises); | ||
} | ||
async add(promise) { | ||
const id = v4_1.default(); | ||
this.promises.set(id, promise.finally(() => { | ||
this.promises.delete(id); | ||
})); | ||
return promise; | ||
} | ||
async wait() { | ||
while (this.promises.size > 0) { | ||
const promises = Array.from(this.promises.values()); | ||
this.promises.clear(); | ||
await Promise.all(promises); | ||
} | ||
} | ||
get size() { | ||
return this.promises.size; | ||
} | ||
static async add(promise) { | ||
return this.instance.add(promise); | ||
} | ||
static async wait() { | ||
await this.instance.wait(); | ||
} | ||
} | ||
AsyncGroup.instance = new AsyncGroup(); | ||
return AsyncGroup; | ||
})(); | ||
get size() { | ||
return this.promises.size; | ||
} | ||
static async add(promise) { | ||
return this.instance.add(promise); | ||
} | ||
static async wait() { | ||
await this.instance.wait(); | ||
} | ||
} | ||
exports.default = AsyncGroup; | ||
AsyncGroup.instance = new AsyncGroup(); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@highoutput/async-group", | ||
"version": "0.3.6", | ||
"version": "0.3.8", | ||
"description": "Groups together multiple promises and allows to 'wait' for all of them to settle.", | ||
@@ -23,3 +23,2 @@ "author": "High Output Ventures", | ||
"@types/node": "^14.11.1", | ||
"ckeditor5": "^29.0.0", | ||
"uuid": "^3.4.0" | ||
@@ -30,3 +29,3 @@ }, | ||
"rimraf": "^3.0.0", | ||
"typescript": "^3.9.3" | ||
"typescript": "^4.4.2" | ||
}, | ||
@@ -36,3 +35,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "76c143b8b6f06853048fb14a1e0c77e9edb4cb56" | ||
"gitHead": "bbe508c18a9a819eec9288f41a741cd0aeaeeb92" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
5109
45
- Removedckeditor5@^29.0.0
- Removed@ckeditor/ckeditor5-clipboard@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-core@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-engine@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-enter@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-paragraph@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-select-all@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-typing@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-ui@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-undo@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-upload@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-utils@29.2.0(transitive)
- Removed@ckeditor/ckeditor5-widget@29.2.0(transitive)
- Removedckeditor5@29.2.0(transitive)
- Removedlodash-es@4.17.21(transitive)