Compare commits

...

2 Commits

Author SHA1 Message Date
326030456f 6.0.8 2023-11-13 14:59:04 +01:00
184dc98127 fix(core): update 2023-11-13 14:59:03 +01:00
3 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@push.rocks/lik",
"version": "6.0.7",
"version": "6.0.8",
"private": false,
"description": "light little helpers for node",
"main": "dist_ts/index.js",

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/lik',
version: '6.0.7',
version: '6.0.8',
description: 'light little helpers for node'
}

View File

@ -31,4 +31,17 @@ export class BackpressuredArray<T> {
checkSpaceAvailable(): boolean {
return this.data.length < this.highWaterMark;
}
waitForSpace(): Promise<void> {
return new Promise<void>((resolve) => {
if (this.checkSpaceAvailable()) {
resolve();
} else {
const subscription = this.hasSpace.subscribe(() => {
subscription.unsubscribe();
resolve();
});
}
});
}
}