mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 02:11:54 +00:00
feat: move cache to optional constructor argument, so it can be exter… (#64)
* feat: move cache to optional constructor argument, so it can be externalized Signed-off-by: waterplea <alexander@inkin.ru> * chore: make cache private Signed-off-by: waterplea <alexander@inkin.ru> --------- Signed-off-by: waterplea <alexander@inkin.ru>
This commit is contained in:
@@ -24,12 +24,13 @@ export class PatchDB<T extends { [key: string]: any }> {
|
||||
}
|
||||
} = {}
|
||||
|
||||
readonly cache$ = new BehaviorSubject<Dump<T>>({
|
||||
id: 0,
|
||||
value: {} as T,
|
||||
})
|
||||
|
||||
constructor(private readonly source$: Observable<Update<T>[]>) {}
|
||||
constructor(
|
||||
private readonly source$: Observable<Update<T>[]>,
|
||||
private readonly cache$ = new BehaviorSubject<Dump<T>>({
|
||||
id: 0,
|
||||
value: {} as T,
|
||||
}),
|
||||
) {}
|
||||
|
||||
start() {
|
||||
if (this.sub) return
|
||||
|
||||
Reference in New Issue
Block a user