├── .gitignore ├── README.md ├── package.json └── src └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Actually... 2 | 3 | Someone else has more time than me. Checkout [vue-pouch](https://github.com/qurateinc/vue-pouch)! 4 | 5 | --- 6 | 7 | # vue-pouchdb 8 | 9 | [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE) 10 | [![Patreon](https://img.shields.io/badge/donate-patreon-orange.svg?style=flat-square)](https://www.patreon.com/BigBlueHat) 11 | 12 | [Vue.js](http://vuejs.com/) plugin that adds [PouchDB](http://pouchdb.com/) 13 | to your Vue.js apps. 14 | 15 | It also (currently) includes 16 | [pouchdb-authentication](http://github.com/nolanlawson/pouchdb-authentication) 17 | because you probably should use that if you're building browser apps. :smiley_cat: 18 | 19 | It's a tiny useful bit of code I extraced from [BlueInk](http://github.com/BigBlueHat/BlueInk). 20 | 21 | ## Usage 22 | 23 | Assumes [browserify](http://browserify.org/): 24 | 25 | ``` 26 | Vue.use(require('vue-pouchdb'), {name: 'database-name'}); 27 | ``` 28 | 29 | The first option is the plugin--see 30 | [Vue.use()](http://vuejs.org/guide/plugins.html#Using_a_Plugin) for more info. 31 | The second option is the [options object for PouchDB](https://pouchdb.com/api.html#create_database). 32 | 33 | If you want to use this with [Apache CouchDB](http://couchdb.apache.org/) or [Cloudant](http://cloudant.com/), pass a database URL as the `name`. Easy peasy! :smiley_cat: 34 | 35 | ## License 36 | 37 | MIT 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-pouchdb", 3 | "version": "1.0.0", 4 | "description": "Vue.js plugin for PouchDB", 5 | "main": "src/index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/BigBlueHat/vue-pouchdb.git" 12 | }, 13 | "keywords": [ 14 | "Vue", 15 | "PouchDB" 16 | ], 17 | "author": "BigBlueHat ", 18 | "license": "MIT", 19 | "bugs": { 20 | "url": "https://github.com/BigBlueHat/vue-pouchdb/issues" 21 | }, 22 | "homepage": "https://github.com/BigBlueHat/vue-pouchdb#readme" 23 | } 24 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | var PouchDB = require('pouchdb'); 2 | PouchDB.plugin(require('pouchdb-authentication')); 3 | 4 | /** 5 | * Create a single PouchDB instance on all Vue VM's that have this plugin 6 | **/ 7 | exports.install = function(Vue, options) { 8 | Vue.prototype.$db = new PouchDB(options); 9 | }; 10 | --------------------------------------------------------------------------------