fix(core): update
This commit is contained in:
parent
326030456f
commit
dfe973f5d8
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/lik',
|
||||
version: '6.0.8',
|
||||
version: '6.0.9',
|
||||
description: 'light little helpers for node'
|
||||
}
|
||||
|
@ -3,19 +3,18 @@ import * as plugins from './lik.plugins.js';
|
||||
export class BackpressuredArray<T> {
|
||||
private data: T[];
|
||||
private highWaterMark: number;
|
||||
public hasSpace: plugins.smartrx.rxjs.Subject<void>;
|
||||
public hasSpace = new plugins.smartrx.rxjs.Subject<'hasSpace'>();
|
||||
|
||||
constructor(highWaterMark: number = 16) {
|
||||
this.data = [];
|
||||
this.highWaterMark = highWaterMark;
|
||||
this.hasSpace = new plugins.smartrx.rxjs.Subject<void>();
|
||||
}
|
||||
|
||||
push(item: T): boolean {
|
||||
this.data.push(item);
|
||||
const spaceAvailable = this.checkSpaceAvailable();
|
||||
if (spaceAvailable) {
|
||||
this.hasSpace.next();
|
||||
this.hasSpace.next('hasSpace');
|
||||
}
|
||||
return spaceAvailable
|
||||
}
|
||||
@ -23,7 +22,7 @@ export class BackpressuredArray<T> {
|
||||
shift(): T | undefined {
|
||||
const item = this.data.shift();
|
||||
if (this.checkSpaceAvailable()) {
|
||||
this.hasSpace.next();
|
||||
this.hasSpace.next('hasSpace');
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user