Subscribes to all documents in a collection.
import { onAll, collection } from 'typesaurus' type User = { name: string } const users = collection<User>('users') onAll(users, allUsers => { console.log(allUsers.length) //=> 420 console.log(allUsers[0].ref.id) //=> '00sHm46UWKObv2W7XK9e' console.log(allUsers[0].data) //=> { name: 'Sasha' } })
The collection to get all documents from
The function which is called with all documents array when the initial fetch is resolved or the collection updates.
The function is called with error when request fails.
Generated using TypeDoc
Subscribes to all documents in a collection.
import { onAll, collection } from 'typesaurus' type User = { name: string } const users = collection<User>('users') onAll(users, allUsers => { console.log(allUsers.length) //=> 420 console.log(allUsers[0].ref.id) //=> '00sHm46UWKObv2W7XK9e' console.log(allUsers[0].data) //=> { name: 'Sasha' } })