firebase-paginator-snapshot
v1.0.9
Published
install package
Readme
firebase-paginator-snapshot
install package
$ npm install firebase-paginator-snapshotget parameters
List of params
name | Type | Description ---------- | ------- | ---------- | query | Function | Query from firebase callback | Function | function for received results from firebase query limit | Number | limit of documents firebase must return key | String | key to identify your data in the paginator object
import paginator from 'firebase-paginator-snapshot'how to use
- create default query
import firebase from 'firebase'
const QUERY = () =>
firebase
.firestore()
.collection("list")
.where("x","==","y")- get first items
const limit = 10
const callback = ({data}) => {
console.log(data)
}
paginator().get(QUERY(), callback, limit, 'key')- get more items
const limit = 10
const callback = ({data}) => {
console.log(data)
}
paginator().get(QUERY(), callback, limit, 'key')- verify end of query
paginator().hasEnded()
// return a boolean- shotdown all listeners
paginator().offListeners()