fix(core): update
This commit is contained in:
parent
702ce00288
commit
184dc98127
@ -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'
|
||||
}
|
||||
|
@ -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();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user