feat: move cache to optional constructor argument, so it can be externalized

Signed-off-by: waterplea <alexander@inkin.ru>
This commit is contained in:
waterplea
2024-06-21 15:18:11 +05:00
parent 7aa53249f9
commit a2377e6206

View File

@@ -24,12 +24,13 @@ export class PatchDB<T extends { [key: string]: any }> {
}
} = {}
constructor(
private readonly source$: Observable<Update<T>[]>,
readonly cache$ = new BehaviorSubject<Dump<T>>({
id: 0,
value: {} as T,
})
constructor(private readonly source$: Observable<Update<T>[]>) {}
}),
) {}
start() {
if (this.sub) return