fix(core): update

This commit is contained in:
Philipp Kunz 2023-11-13 14:59:03 +01:00
parent 702ce00288
commit 184dc98127
2 changed files with 14 additions and 1 deletions

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();
});
}
});
}
} }