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", "name": "@push.rocks/lik",
"version": "6.0.7", "version": "6.0.8",
"private": false, "private": false,
"description": "light little helpers for node", "description": "light little helpers for node",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

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

View File

@ -31,4 +31,17 @@ export class BackpressuredArray<T> {
checkSpaceAvailable(): boolean { checkSpaceAvailable(): boolean {
return this.data.length < this.highWaterMark; 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();
});
}
});
}
} }