{"bugs":{"url":"https://github.com/vuejs/vuefire/issues"},"dist":{"shasum":"1317bae201b0f3379d31d68783f81bf652abaf16","tarball":"https://registry.npmjs.org/vuexfire/-/vuexfire-3.0.0-alpha.17.tgz","fileCount":12,"integrity":"sha512-HMAe4re3GtIauzceMrGeV53bWzD9a9FTR6UoIvrdi9E7z1fZy4UR/Ehy+JEOI+q0TzZ6PtLsCep1KnT8lt6/yg==","signatures":[{"sig":"MEYCIQCFMqLzu+T+7ZDRv3S4AXPNy+d0HkFDJdCO1EOgv8mZpAIhAMShvEOqFZHP0+AYLZyVtPuqJrS61cwlbiLdeSkd8z2z","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82475,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc1GmGCRA9TVsSAnZWagAA9+QP+wf+0iahuMUNFA+wex7g\nUSCXg2FfjLtF2j4lxvormAlopNUmYEggqoR5sN0PGZHi956tr1OkKrrMLeuK\n8EmcuM37rLOnNTI4Mn0G5ZzKfBFx2RK1NBIT7U+v2j5P8Ngg7bR5A7E1QiH2\nHlOxbctTBwQvtqpk/OU3EfmF+qOk+kiivdpUIIDoedIrbKj6ZgnBJz3CQnez\nvx4UB05dOUmG5s9TVx6BRpeweUT6ILCCs10WHUWVmg8YkcyI22krR8AwS0eL\nCFKuaRHm7ynXDWSlERB4RgPAlS9xAJhSLiR97gb1YE8n1j/O/VVSa4CvqXDL\nKTXx4FMOCaMjzCbeAKXUl6yxEt7gjLsVDiE/Gw8nTcECp6vIhB3FWIbADiOf\nNOpFE/ISfv5KqtC819kiM1xlRPcIHiMMsCn4Cb8AdmtuwO/kfdK3G2XWHJV4\nNW/GA7/lPjUFo+GxksnblT4pIHzlGxaTJjwNu6bNLeScE+pgtFE5lMtjJM/m\np09ZNvjhuwOkvh65EU+NEzOEs7s7vRKRiku30YIhj3CW0frevJjxXdk+bYqU\nqeJM815iCrfTab7mPvvBxrBadPFZiRK/vXadR0EnKD+ixGGXX/mP5uR2Sp0f\ndQq6XyMl5AoKP6wz2LDCrYQ9lM6GRGu455uyLQZ8WkuFwNImHP1Ay9mE2D2N\n8Raz\r\n=phGn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/vuexfire.common.js","name":"vuexfire","types":"types/index.d.ts","unpkg":"dist/vuexfire.js","author":{"name":"Eduardo San Martin Morote"},"module":"dist/vuexfire.esm.js","readme":"# Vuexfire [![Build Status](https://badgen.net/circleci/github/vuejs/vuefire)](https://circleci.com/gh/vuejs/vuefire) [![npm package](https://badgen.net/npm/v/vuexfire/next)](https://www.npmjs.com/package/vuexfire) [![coverage](https://badgen.net/codecov/c/github/vuejs/vuefire)](https://codecov.io/github/vuejs/vuefire)\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 { vuexfireMutations } 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    ...vuexfireMutations,\n  },\n})\n```\n\nIt works with modules as well, but **you don't need to add the mutations there**:\n\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, `bindFirestoreRef` and `unbindFirestoreRef`:\n\n```js\nimport { firestoreAction } from 'vuexfire'\n\nconst setTodosRef = firestoreAction(\n  ({ bindFirestoreRef, unbindFirestoreRef }, { ref }) => {\n    // this will unbind any previously bound ref to 'todos'\n    bindFirestoreRef('todos', ref)\n    // you can unbind any ref easily\n    unbindFirestoreRef('user')\n  }\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 [atlassian/WeakMap](https://github.com/atlassian/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 `firestoreAction`, 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### vuexfireMutations\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### bindFirestoreRef(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\nbindFirestoreRef('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\nbindFirestoreRef('todos', ref)\n  .then(() => {\n    commit('setTodosLoaded', true)\n  })\n  .catch(err => {\n    console.log(err)\n  })\n```\n\n### unbindFirestoreRef(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\nunbindFirestoreRef('todos')\n```\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n","browser":"dist/vuexfire.esm.js","gitHead":"ed1ee4682cc45f26b27e3e0ef8bfc9a4b3e51205","license":"MIT","scripts":{"dev":"npm run test:unit -- --watchAll","lint":"eslint --color --ext=js,html src test examples","test":"npm run build && npm run types && npm run test:unit","build":"node --eval 'require(\"@posva/vuefire-bundler\")(\"Vuexfire\")'","types":"tsc -p ./types/test/tsconfig.json","pretest":"npm run lint","test:unit":"jest","postversion":"npm run build"},"_npmUser":{"name":"posva","email":"posva13@gmail.com"},"homepage":"https://github.com/vuejs/vuefire#readme","keywords":["vuex","fire","vue","realtime","database","google","firebase","redux","firestore","store","bind"],"repository":{"url":"git+https://github.com/vuejs/vuefire.git","type":"git"},"_npmVersion":"lerna/3.13.4/node@v10.15.3+x64 (darwin)","description":"Firestore binding for Vuex","directories":{},"maintainers":[{"name":"posva","email":"posva13@gmail.com"}],"sideEffects":false,"_nodeVersion":"10.15.3","dependencies":{"@posva/vuefire-core":"^1.1.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.7.1","vuex":"^3.0.1","eslint":"^5.9.0","codecov":"^3.1.0","firebase":"^5.11.1","typescript":"^3.4.5","@babel/core":"^7.0.0-0","@types/jest":"^24.0.12","@babel/preset-env":"^7.4.4","@posva/vuefire-bundler":"^1.1.3","eslint-plugin-vue-libs":"^3.0.0","@posva/vuefire-test-helpers":"^1.0.4"},"peerDependencies":{"firebase":">= 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vuexfire_3.0.0-alpha.17_1557424517199_0.45926543074717663","host":"s3://npm-registry-packages"},"_id":"vuexfire@3.0.0-alpha.17","version":"3.0.0-alpha.17"}