{"bugs":{"url":"https://github.com/posva/vuexfire/issues"},"dist":{"shasum":"0703179f195f9b6143f15ed7b10db9acffc0d375","tarball":"https://registry.npmjs.org/vuexfire/-/vuexfire-3.0.0-alpha.1.tgz","fileCount":11,"integrity":"sha512-cIyiq0qbUAQyLMvjYeODu1Ek7iX+btW3qhZwe34Kt0NnvwO6k+KYuLZ19qcdiz9l7aVU4eXDzFa/RpuE4Cj9KA==","signatures":[{"sig":"MEYCIQDtSTUglZ2+6mJ1RS5yJp2LYYph7iFb/7MLu+V33p3A8wIhANJoJa/0zrJplwuRULBFkT6k4i2lz+MaN/KqQyr+bV7v","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":61380},"main":"dist/vuexfire.cjs.js","name":"vuexfire","files":["src","dist","LICENSE","README.md"],"unpkg":"dist/vuexfire.js","author":{"name":"Eduardo San Martin Morote","email":"posva13@gmail.com"},"module":"dist/vuexfire.es.js","readme":"# VuexFire [![Build Status](https://img.shields.io/circleci/project/posva/vuexfire/master.svg)](https://circleci.com/gh/posva/vuexfire) [![npm package](https://img.shields.io/npm/v/vuexfire.svg)](https://www.npmjs.com/package/vuexfire) [![coverage](https://img.shields.io/codecov/c/github/posva/vuexfire/master.svg)](https://codecov.io/github/posva/vuexfire) ![size](http://img.badgesize.io/posva/vuexfire/master/dist/vuexfire.min.js.svg?compression=gzip)\n\n> SSR ready Firebase binding for [Vuex](https://github.com/vuejs/vuex)\n\nSupports only Vue 2, Vuex 2 and Firebase JavaScript SDK 2/3/4.\nIf you need an older version check the `v1` branch: `npm i -D vuexfire@v1`\n\n## Installation\n\n1. Using a CDN:\n\n``` html\n<script src=\"https://unpkg.com/vuexfire\"></script>\n```\n\n2. In module environments, e.g CommonJS:\n\n``` bash\nnpm install vue firebase vuexfire --save\n```\n\n## Usage\n\nAdd the mutations to your root Store and make sure to define the property you\nwant to bind in the state first:\n\n``` js\nimport { firebaseMutations } from 'vuexfire'\nconst store = new Vuex.Store({\n  state: {\n    todos: [], // Will be bound as an array\n    user: null // Will be bound as an object\n  },\n  mutations: {\n    // your mutations\n    ...firebaseMutations\n  }\n})\n```\n\nIt works with modules as well, but **you don't need to add the mutations there**:\n```js\nconst store = new Vuex.Store({\n  modules: {\n    todos: {\n      state: {\n        todos: [], // Will be bound as an array\n        user: null // Will be bound as an object\n      },\n    }\n  }\n})\n```\n\nIn order to use VuexFire, you have to enhance actions. This action enhancer\ntakes the actual action and enhances it with two additional parameters in the\ncontext, `bindFirebaseRef` and `unbindFirebaseRef`:\n\n```js\nimport { firebaseAction } from 'vuexfire'\n\nconst setTodosRef = firebaseAction(({ bindFirebaseRef, unbindFirebaseRef }, { ref }) => {\n  // this will unbind any previously bound ref to 'todos'\n  bindFirebaseRef('todos', ref)\n  // you can unbind it easily too\n  unbindFirebaseRef('todos')\n})\n```\n\nAccess it as a usual piece of the state:\n\n```js\nconst Component = {\n  template: '<div>{{ todos }}</div>',\n  computed: Vuex.mapState(['todos']),\n  created () {\n    this.$store.dispatch('setTodosRef', db.ref('todos'))\n  }\n}\n```\n\n## Browser support\n\nVuexFire requires basic `WeakMap` support, which means that if you need to\nsupport any of these browsers:\n\n- IE < 11\n- Safari < 7.1\n- Android < 5.0\n\nYou'll have to include a polyfill. You can\nuse [Benvie/WeakMap](https://github.com/Benvie/WeakMap)\n\nYou can find more information about `WeakMap`\nsupport [here](http://kangax.github.io/compat-table/es6/#test-WeakMap)\n\n## How does it work?\n\nVuexFire uses multiple global mutations prefixed by `vuexfire/` to call the\nactual mutations to modify objects and arrays. It listens for updates to your\nfirebase database and commits mutations to sync your state. Thanks to the action\nenhancer `firebaseAction`, it gets access to the local `state` and `commit` so\nit works with modules too :+1:\n\n## Examples\n\nYou can check out the examples by opening the html files in your browser, or check [this online Demo](https://jsfiddle.net/posva/6w3ks04x/)\n\n## API\n\n### firebaseMutations\n\nThis object contains VuexFire internal mutations. They are all prefixed by\n`vuexfire/`. This object must be added in the root Store mutations object.\n\n### bindFirebaseRef(key, ref[, options])\n\n_Only available inside of an enhanced action_\n\nBinds a firebase reference to a property in the state. If there was already\nanother reference bound to the same property, it unbinds it first.\n\n#### options:\n\n```js\n{\n  cancelCallback: Function, // Cancel callback passed to Firebase when listening for events\n  readyCallback: Function, // Callback called once the data has been loaded. Useful for SSR\n  errorCallback: Function, // Callback called when there is an error loading the data. Useful for SSR\n  wait: Boolean, // (Arrays only) Should Vuexfire wait for the whole array to be populated. Defaults to true\n}\n```\n\n`wait` can be set to true every time. It's useful to do pagination and SSR.\n\n### unbindFirebaseRef(key)\n\n_Only available inside of an enhanced action_\n\nUnbinds a bound firebase reference to a given property in the state.\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n\n## Support on Beerpay\nHey dude! Help me out for a couple of :beers:!\n\n[![Beerpay](https://beerpay.io/posva/vuexfire/badge.svg?style=beer-square)](https://beerpay.io/posva/vuexfire)  [![Beerpay](https://beerpay.io/posva/vuexfire/make-wish.svg?style=flat-square)](https://beerpay.io/posva/vuexfire?focus=wish)\n","browser":"dist/vuexfire.js","gitHead":"e1b03a788d51c650bac2d22bec1436a14dcebc86","license":"MIT","scripts":{"dev":"npm-watch","lint":"eslint --color --ext=js,html src test examples build","test":"npm run lint && npm run test:coverage && npm run build","build":"rollit","release":"release-it pre --preReleaseId=alpha --npm.tag=next --github.preRelease","coverage":"nyc report --reporter=text-lcov > coverage.lcov && codecov","dev:test":"npm run test:unit -- --watch","prebuild":"rimraf dist","test:unit":"ava","test:coverage":"nyc npm run test:unit","prepublishOnly":"npm run build"},"_npmUser":{"name":"posva","email":"posva13@gmail.com"},"homepage":"https://github.com/posva/vuexfire#readme","keywords":["vuex","fire","vue","realtime","database","google","firebase","redux","firestore","store","bind","opinionated"],"repository":{"url":"git+https://github.com/posva/vuexfire.git","type":"git"},"_npmVersion":"5.6.0","description":"Firestore binding for Vuex","directories":{},"maintainers":[{"name":"posva","email":"posva13@gmail.com"}],"_nodeVersion":"8.6.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"vue":"^2.4.2","vuex":"^3.0.0","eslint":"^4.6.0","rimraf":"^2.6.2","codecov":"^3.0.0","babel-preset-env":"^1.6.0","eslint-config-posva":"^1.3.0"},"peerDependencies":{"firebase":">= 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vuexfire_3.0.0-alpha.1_1519593696184_0.23014988607743403","host":"s3://npm-registry-packages"},"_id":"vuexfire@3.0.0-alpha.1","version":"3.0.0-alpha.1"}