From a2377e62066bb09dc63ca85ea03d87a103598b64 Mon Sep 17 00:00:00 2001 From: waterplea Date: Fri, 21 Jun 2024 15:18:11 +0500 Subject: [PATCH] feat: move cache to optional constructor argument, so it can be externalized Signed-off-by: waterplea --- client/lib/patch-db.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/lib/patch-db.ts b/client/lib/patch-db.ts index cb428ac..8d669e9 100644 --- a/client/lib/patch-db.ts +++ b/client/lib/patch-db.ts @@ -24,12 +24,13 @@ export class PatchDB { } } = {} - readonly cache$ = new BehaviorSubject>({ - id: 0, - value: {} as T, - }) - - constructor(private readonly source$: Observable[]>) {} + constructor( + private readonly source$: Observable[]>, + readonly cache$ = new BehaviorSubject>({ + id: 0, + value: {} as T, + }), + ) {} start() { if (this.sub) return