{"bugs":{"url":"https://github.com/posva/vuexfire/issues"},"dist":{"shasum":"a6a73969f1866f35a604fd5a4675c9d3d97d8654","tarball":"https://registry.npmjs.org/vuexfire/-/vuexfire-3.0.0-alpha.2.tgz","fileCount":11,"integrity":"sha512-3dlVD/Tf+gSLA7R87hLcPlq58MAaqWMlgdGCCAMurS2Og4vKJWXynL8CEdSy2yn4NJczCH4wyEsVe693DXrbRw==","signatures":[{"sig":"MEUCIQDGt2EGlfB+8MXYxj9Emc9NYuqySfzIzU6ET7ckHOHB/wIgYOP92t3/GidZy+zN/j+jsEi5JZ4nmMkutif90auRhzE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":61693,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa042/CRA9TVsSAnZWagAArkwP/2WELnFyd7SBa6TkxSrO\nXGChHmEa5AbwA48zY+V6bdosInv48Aca6bOuIaSEbNJ0VbKLmiNhlZLB/+Sc\nciEByMcQiSBimsN/IWWcC4Znujca2JWiQs7VD4tr8eZSOs8VpfRI1OqeVbB/\nNsA8DsKVYHJpAODwgAKO8anHOjmZkhG0SR00P08M6e+sakYrYeuOjs17J8fw\n3gH2/+7INoEwMFiCUhi1AMpEA7EAeydPbyW5A+BpHSCLhxR9IGw2VkqSHZ+D\nAVWe6/yYeTaYHRTGP6GaImtBI7umAaDFwYKrzeBtTa6UgcfHsM2tQ6dQJPxG\nV9/uYHCooaXC85i/g8QuvHpQCU1hPCJt6KjmeKL/El2iBDUnXuJtqvCULfPi\nNfG8RYamf/92QaIs0q5JzHRP88BVbfiiBydXKNOQCCRQTstDcOCmKo+0dXAJ\n9zXIPVEkyExuvwpdrjhaVLoEVDro/NMYgHesSl9XoAxbohh54aKgz/sG1dAK\nuWOqxv5pTC0y4vrPMwA9T7QudzMW6ocOBAvZm+CCLfn2a6Fc5NhYLj54k9je\n0z2JK/vqlVHa+g95kDTP6gqrIHuMKAmRBYfzWgFicFRfAJl8ddhgoi2rgCDr\ncMFeF9tNqFtolBQQWvChcvOV5fJ0FBK+jNOPwglIPMfRNkvTf+xvDRqKud2Z\nlS2J\r\n=pmoX\r\n-----END PGP SIGNATURE-----\r\n"},"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@next\"></script>\n```\n\n2. In module environments, e.g CommonJS:\n\n``` bash\nnpm install vue firebase vuexfire@next --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.collection('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 a complete example in the `/examples` directory.\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)\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```js\nbindFirebaseRef('todos', ref)\n```\n\nReturns a promise which will resolve when the data is ready, or throw an error if something goes wrong:\n\n```js\nbindFirebaseRef('todos', ref).then(() => {\n  commit('setTodosLoaded', true)\n}).catch((err) => {\n  console.log(err)\n})\n```\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```js\nunbindFirebaseRef('todos')\n```\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.es.js","gitHead":"d13ec0005ac170b731e7881ff9092099941ae23e","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.8.0","description":"Firestore binding for Vuex","directories":{},"maintainers":[{"name":"posva","email":"posva13@gmail.com"}],"_nodeVersion":"8.9.4","_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.2_1523813822137_0.8228662995720277","host":"s3://npm-registry-packages"},"_id":"vuexfire@3.0.0-alpha.2","version":"3.0.0-alpha.2"}