observablePart as method pon deepState
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
import { createObservablePart } from "./create-observable-part.method";
|
||||
|
||||
|
||||
// TODO: Should this handle array as well?
|
||||
@@ -50,6 +51,13 @@ export class DeepState<T> extends BehaviorSubject<T> {
|
||||
super(deepFreeze(initialData));
|
||||
}
|
||||
|
||||
observablePart<ReturnType>(
|
||||
mappingFunction: MappingFunction<T, ReturnType>,
|
||||
memoizationFunction?: MemoizationFunction<ReturnType>
|
||||
) {
|
||||
return createObservablePart(this, mappingFunction, memoizationFunction);
|
||||
}
|
||||
|
||||
next(newData: T): void {
|
||||
const frozenData = deepFreeze(newData);
|
||||
// Only update data if its different than current data.
|
||||
|
||||
Reference in New Issue
Block a user