Vuefire Core
Core logic used for vuefire and vuexfire
This library is intended for internal usage. You are free to use it to create your own plugins but keep in mind that the main target is a Vue plugin
Installation
npm i @posva/vuefire-core
Usage
import { bindCollection, bindDocument, walkSet } from '@posva/vuefire-core'
const ops = {
set: (target, path, value) => walkSet(target, path, value),
add: (array, index, data) => array.splice(index, 0, data),
remove: (array, index) => array.splice(index, 1),
}
const vm = new Vue({
})
const resolve = data => {
console.log('reference bound:', data)
}
const reject = err => {
console.log('error binding reference:', err)
}
const unbindItems = bindCollection(
{
vm,
key: 'items',
ops,
collection: db.collection('items'),
resolve,
reject,
},
{
maxRefDepth: 2,
}
)
const unbindItem = bindDocument(
{
document: db.collection('items').doc('0'),
},
options
)
unbindItems()
bindCollection({
key: 'items',
})
License
MIT