Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@posva/vuefire-core

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@posva/vuefire-core

Shared code for vue + Firebase apps used by vuefire and vuexfire

  • 2.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.5K
increased by56.07%
Maintainers
1
Weekly downloads
 
Created
Source

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'

// create an object of operations
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({
  // options
})

const resolve = data => {
  console.log('reference bound:', data)
}

const reject = err => {
  console.log('error binding reference:', err)
}

// unbind is a function that tears down all listeners
const unbindItems = bindCollection(
  {
    // vm could be just an object
    vm,
    // key set on vm
    key: 'items',
    ops,
    collection: db.collection('items'),
    // this is to enable Promise based APIs
    // callback on success
    resolve,
    // callback on error
    reject,
  },
  // default options
  {
    maxRefDepth: 2,
  }
)

const unbindItem = bindDocument(
  {
    // same options as bindCollection except for collection -> document
    document: db.collection('items').doc('0'),
  },
  options
)

unbindItems()
bindCollection({
  // bind a different collection
  key: 'items',
})

License

MIT

FAQs

Package last updated on 07 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc