How to use the @posva/vuefire-core.firestoreOptions.serialize function in @posva/vuefire-core

To help you get started, we’ve selected a few @posva/vuefire-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vuefire / packages / vuefire / src / firestore.ts View on Github external
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
github vuejs / vuefire / packages / vuefire / src / index.js View on Github external
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 => {