rx-store-core
Version:
A Rxjs and Immutable based Type-safe state management tool
19 lines (16 loc) • 544 B
text/typescript
import { BehaviorSubject, debounceTime, Observer } from "rxjs";
import { AbstractSubjectWithValue } from "./AbstractSubjectWithValue";
export class AsyncBeheviorSubjectWithValue<T> extends AbstractSubjectWithValue<
T,
BehaviorSubject<T>
> {
constructor(public value: T) {
super(value, new BehaviorSubject<T>(value));
}
subscribe(observer: Observer<T>) {
return this.source.pipe(debounceTime(0)).subscribe(observer);
}
asObservable() {
return this.source.asObservable().pipe(debounceTime(0));
}
}