firestash

FireStash is a way to easily maintain an aggressive local cache of FireStore collections to reduce read costs and simplify data sync logic.

Usage no npm install needed!

<script type="module">
  import firestash from 'https://cdn.skypack.dev/firestash';
</script>

README

FireStash

FireStash is a way to easily maintain an aggressive local cache of FireStore collections to reduce read costs and simplify data sync logic.

FireStash.get<Obj = object>(collection: string, documentId: string | string[]): Promise<Obj>;
FireStash.update(collection: string, documentId: string, object?: Json): Promise<void>;
FireStash.delete(collection: string, documentId: string): Promise<void>;
FireStash.watch(collection: string): Promise<() => void>;
FireStash.unwatch(collection: string): Promise<void>;
FireStash.stop(): Promise<void>;
FireStash.bust(collection: string, documentId?: string): Promise<void>;
FireStash.ensure(collection: string, documentId?: string): Promise<void>;
FireStash.purge(collection: string): Promise<void>;
FireStash.stash(collection: string): Promise<Record<string, number>>;
FireStash.cacheKey(collection: string, page: number): string;