Docs

Firestore class

A thin observable wrapper around Firestore's SDK

Arguments

NameTypeRequiredDefaultDescription
apifirebae.firestore

A Firebase SDK Firestore instance

initialStateobject

the initial state of the store, perfect for server rendering hydration process

optionsobject

an options object which accepts DocumentSnapshot, QuerySnapshot and QueryDocumentSnapshot

Methods

getValue function

Synchronously returns an observable value from the local cache.

Arguments

NameTypeRequiredDefaultDescription
pathstring

the path of the data in the database

optionsobject

an options object which accepts where, orderBy, limit

Methods

Returns - any

setValue function

Writes into a path and updates local cache. if the path is a collection path, a document with an auto generated id will be pushed

Arguments

NameTypeRequiredDefaultDescription
pathstring

the path of the data in the database

valueany

the new value to write

Methods

Returns - promise

listen function

Register a path to listen to, updates will update th local cache automatically

Arguments

NameTypeRequiredDefaultDescription
pathstring

the path of the data in the database

optionsobject

an options object which accepts where, orderBy, limit

Methods

Returns - function

a destroy function for the listener

load function

Loads a value once from the database and update the local cache

Arguments

NameTypeRequiredDefaultDescription
pathstring

the path of the data in the database

optionsobject

an options object which accepts where, orderBy, limit

Methods

Returns - promise

when resolved, will contain the loaded value

remove function

Removes a path from the database and local cache

Arguments

NameTypeRequiredDefaultDescription
pathstring

the path of the data in the database

Methods

Returns - promise