createCollectionGroupStore()
createCollectionGroupStore<T>(firestore, ref, options)
creates a store based
on a collection group reference. The store will update when the collection group changes.
Parameters
firestore: Firestore
- The firebase firestore instance. If you put the component at the root of your app, or higher than where you're using this store, you can usenull
orundefined
as the parameter and the store will retrieve the firestore instance from the context.ref: string | Query
- The query to create the store from.options?: CollectionStoreOptions<T>
- Options for the store.
Properties
subscribe: ((val: T) => void)) => void;
- Subscribe method for the Svelte store. Allows for the `$store` syntax.ref: Query
- The collection reference used to create the store.loading: boolean
- If the collection is loading (undefined)error: Error | null
- Error if any
Types
interface CollectionStoreOptions<T> {
log?: boolean;
once?: boolean;
startValue?: T;
refField?: string;
}