The reference to the document
The function which is called with the document when the initial fetch is resolved or the document updates.
The function is called with error when request fails.
Function that unsubscribes the listener from the updates
Subscribes to the diven document.
import { onGet, collection } from 'typesaurus'
type User = { name: string }
const users = collection<User>('users')
onGet(users, '00sHm46UWKObv2W7XK9e', sasha => {
console.log(sasha.ref.id)
//=> '00sHm46UWKObv2W7XK9e'
console.log(sasha.data)
//=> { name: 'Sasha' }
})
The document collection
The document id
The function which is called with the document when the initial fetch is resolved or the document updates.
The function is called with error when request fails.
Function that unsubscribes the listener from the updates
Generated using TypeDoc
Subscribes to the diven document.
import { onGet, collection } from 'typesaurus' type User = { name: string } const users = collection<User>('users') onGet(users, '00sHm46UWKObv2W7XK9e', sasha => { console.log(sasha.ref.id) //=> '00sHm46UWKObv2W7XK9e' console.log(sasha.data) //=> { name: 'Sasha' } })