mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 02:11:54 +00:00
feat: remove ionic storage (#51)
This commit is contained in:
committed by
Aiden McClelland
parent
cb8998a79c
commit
5104086317
@@ -31,10 +31,10 @@ export class PatchDB<T extends { [key: string]: any }> {
|
|||||||
|
|
||||||
constructor(private readonly source$: Observable<Update<T>[]>) {}
|
constructor(private readonly source$: Observable<Update<T>[]>) {}
|
||||||
|
|
||||||
async start(bootstrapper: Bootstrapper<T>) {
|
start(bootstrapper: Bootstrapper<T>) {
|
||||||
if (this.sub) return
|
if (this.sub) return
|
||||||
|
|
||||||
const initialCache = await bootstrapper.init()
|
const initialCache = bootstrapper.init()
|
||||||
this.cache$.next(initialCache)
|
this.cache$.next(initialCache)
|
||||||
|
|
||||||
this.sub = this.source$
|
this.sub = this.source$
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ export enum PatchOp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Bootstrapper<T> {
|
export interface Bootstrapper<T> {
|
||||||
init(): Promise<DBCache<T>>
|
init(): DBCache<T>
|
||||||
update(cache: DBCache<T>): Promise<void>
|
update(cache: DBCache<T>): void
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DBCache<T extends Record<string, any>> {
|
export interface DBCache<T extends Record<string, any>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user