Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
vm._firestoreUnbinds[key] = unbind
})
}
interface PluginOptions {
bindName?: string
unbindName?: string
serialize?: FirestoreOptions['serialize']
reset?: FirestoreOptions['reset']
wait?: FirestoreOptions['wait']
}
const defaultOptions: Readonly> = {
bindName: '$bind',
unbindName: '$unbind',
serialize: firestoreOptions.serialize,
reset: firestoreOptions.reset,
wait: firestoreOptions.wait,
}
declare module 'vue/types/vue' {
// TODO: export types to allow custom function names
interface Vue {
$bind(
name: string,
reference: firestore.Query | firestore.CollectionReference,
options?: FirestoreOptions
): Promise
$bind(
name: string,
reference: firestore.DocumentReference,
options?: FirestoreOptions
export function firestorePlugin(
Vue,
{ bindName = '$bind', unbindName = '$unbind', serialize = firestoreOptions.serialize } = {}
) {
const strategies = Vue.config.optionMergeStrategies
strategies.firestore = strategies.provide
const globalOptions = Object.assign({}, firestoreOptions, { serialize })
Vue.mixin({
beforeCreate() {
this._firestoreUnbinds = Object.create(null)
this.$firestoreRefs = Object.create(null)
},
created() {
const { firestore } = this.$options
const refs = typeof firestore === 'function' ? firestore.call(this) : firestore
if (!refs) return
Object.keys(refs).forEach(key => {