https://github.com/manolo/vaadin-pouchdb
polymer web component for pouchdb
https://github.com/manolo/vaadin-pouchdb
Last synced: over 1 year ago
JSON representation
polymer web component for pouchdb
- Host: GitHub
- URL: https://github.com/manolo/vaadin-pouchdb
- Owner: manolo
- Created: 2015-11-03T11:36:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-09-26T09:39:23.000Z (almost 9 years ago)
- Last Synced: 2025-03-27T22:32:38.540Z (over 1 year ago)
- Language: HTML
- Size: 26.4 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
vaadin-pouchdb
========
A polymer web component wrapping [PouchDB](http://pouchdb.com/).
It's goal is the simplicity of setting up an application which works online / offline.
Nothing else needed for observing connectivity, changes in a list, etc.
Disclaimer: I have developed this component on my Comunity-Fridays hours at Vaadin, this is the reason of the component's name. The element is not part of the official set of Vaadin Core Elements.
## Quick Start
```
```
```
// Add a new item to the database.
// We could use db.data instead of grid.items.
this.$.grid.push('items', { name: 'Manolo', country: 'Spain'});
// Modify an item in the database
this.$.grid.set('items.0.country', 'Finland');
// Remove an item from the database
this.$.grid.pop('items');
```
- Use a local database `chat` which will be synchronised with the one specified in the `remote` parameter.
- Remote could be either couchdb or pouchdb. If you don't specify any remote, it will be use a local instance only.
- Any changes in the `data` array using the `Polymer` API will be propagated to the database, and any change in the database to the array.
- Use polymer data-binding as usual.
- Create an index `ts`, and use it to query the database.
- If not provided it get all items sorted by `_id`
- It queries all items in the database (no filtering)
- You could configure the `queryString` parameter though.
## For GWT users
Once you have added the gwt-polymer-api
You can wrap the element using vaadin the gwt-api-generator:
```
$ sudo npm install vaadin/gwt-api-generator -g
$ bower install manolo/vaadin-pouchdb
$ gwt-api-generator
```
Then you will get all needed classes in your `src/main/java` folder
Your project should also depend on vaadin gwt-polymer-elements