{"bugs":{"url":"https://github.com/vuejs/vuefire/issues"},"dist":{"shasum":"3e9c2df4079253d99d0212f177c9638caedab2f1","tarball":"https://registry.npmjs.org/vuexfire/-/vuexfire-3.0.0-alpha.15.tgz","fileCount":12,"integrity":"sha512-x0hvDEsyVMjZJUB6aBtSjP4gObSZ6Z69UIMqZg6sdi5/7g5ENPhV1Ftj0JEzRxTen/Oo3DKP55UDRqvzLXg0EQ==","signatures":[{"sig":"MEYCIQDH7nW0LXmIVj0waeMECd6FW0JoIyD1t765A3uJs8q4lgIhAPu6Gn5WLY182VIeOZkfl3DqmdI6R0nDxvr/KPdNiz3s","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82210,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJclTMYCRA9TVsSAnZWagAAHAIP/2eieleX4R4a0qaWQ3Ez\nZ2uhn1dyePrQCrqEcYcmkKH923W4WdLy6IA+JtWzkZpTJoaqKnYsqDivzuNB\n0sJSYwb0HxjXXlNa5beXSNd9CTwQ8SKvs2mjYq07t0Iyy0yP06U8jB2ONZJW\nJYenKHLPZkKc4D2h+NJ07BI5FSzO3GO+PhFHWZmDXIYxMYB8teYtBMsS74qA\n8oCWew5IgWLCTO5NWPvwUZ3DUsu6/9l40ORWxjUIRNMRt0HGUbLJeJCAPtCC\nSjjSkfQivQzkvDTqj6OdOzY+ylcKL8dTmfXSfX+f8c/u0abKVnboTpoZ/5vr\np0v224UAnP/oYarwosyyecEO4TNRP0/HdSivw3A/zCRQ5C3SFjJcyPBvFKjR\neiTLXBF8oVOb6maV9PIQ1QX51LdIwkKZZki27HqUOCpWAfohVqbUv6irgD02\n8Gq01/jEzcQn8d22gWCJSl/BO2xYgihXb3JCbT40fLVrrDcHMnt9XdrmNIYB\ntpwpMIbrhRWSCg1etAwKPE6E11gkAZXjJ55z3LbYWg7jZk54yhcUZ9oxWE/0\n5bw2wpBcVrwKamz8XKxPvSfYSL8GKYch01z9lnqJFNvz6ojTyieSvkYuuR9A\n7Hwrh/C5/dFbGifXXhtVTPCR/9buOwoxfbwYK7et53UkJ7QLEUiQTYmSR+7u\nInSS\r\n=niXZ\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"collectCoverage":true,"collectCoverageFrom":["<rootDir>/src/**/*.js"]},"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":"9699b0993f67e91d759bab925ea89611dbb05839","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","opinionated"],"repository":{"url":"git+https://github.com/vuejs/vuefire.git","type":"git"},"_npmVersion":"lerna/3.13.1/node@v10.5.0+x64 (darwin)","description":"Firestore binding for Vuex","directories":{},"maintainers":[{"name":"posva","email":"posva13@gmail.com"}],"sideEffects":false,"_nodeVersion":"10.5.0","dependencies":{"@posva/vuefire-core":"^1.1.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^23.6.0","vuex":"^3.0.1","eslint":"^5.9.0","codecov":"^3.1.0","typescript":"^3.2.1","babel-preset-env":"^1.7.0","@posva/vuefire-bundler":"^1.1.2","eslint-plugin-vue-libs":"^3.0.0","@posva/vuefire-test-helpers":"^1.0.3"},"peerDependencies":{"firebase":">= 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vuexfire_3.0.0-alpha.15_1553281815333_0.6538217373782427","host":"s3://npm-registry-packages"},"_id":"vuexfire@3.0.0-alpha.15","version":"3.0.0-alpha.15"}