(#2286) - browserifiable adapter plugins

This finishes up the work @calvinmetcalf and I started on
this some time ago.

Now, you can either use the LocalStorage/memory/idb-alt plugins
as standalone scripts downloaded from the website, or via the
"extras" API, allowing them to be Browserified/Webpacked.

I tested this out and confirmed that, when `require()`d from
a separate project, Browserify does an intelligent job
deduplicating the code. E.g. PouchDB itself is only included once.

For instance, when using Browserify, PouchDB and the memory adapter
will add up to 710K. When using separate standalone scripts, you're
looking at 352K for PouchDB and 470K for the memory plugin script,
which adds up to 822K. So you save nearly 100K, which ain't bad.

This commit should also make it easier to create new browser
adapter plugins in the future. The API is much simplified and
requires a lot less command-line Browserify magic.

Note that the "browserify API" itself is not tested in CI; we're
still testing the standalone scripts the old-fashioned way. But
since the standalone scripts are just browserified versions of the
"extras" APIs (with `-x pouchdb` thrown in to avoid browserifying
PouchDB itself), I think this is pretty low-risk.
25 files changed
tree: 4249073b4ed8cd944e59302d3864a9ca7791a745
  1. bin/
  2. docs/
  3. extras/
  4. lib/
  5. scripts/
  6. tests/
  7. .gitignore
  8. .jshintignore
  9. .jshintrc
  10. .npmignore
  11. .travis.yml
  12. bower.json
  13. component.json
  14. CONTRIBUTING.md
  15. LICENSE
  16. package.json
  17. README.md
  18. TESTING.md
README.md

PouchDB - The Javascript Database that Syncs

Build Status

PouchDB was written to help web developers build applications that work as well offline as well as they do online, applications save data locally so the user can use all the features of an app even while offline and synchronise the data between clients so they have up to date data wherever they go.

PouchDB is a free open source project, written in Javascript by these wonderful contributors and inspired by Apache CouchDB.

Using PouchDB

To get started using PouchDB check out our Documentation and the API Documentation.

Contributors

If you want to get involved then check out the contributing guide

Example

var db = new PouchDB('dbname');

db.put({
 _id: 'dave@gmail.com',
 name: 'David',
 age: 68
});

db.changes().on('change', function() {
  console.log('Ch-Ch-Changes');
});

db.replicate.to('http://example.com/mydb');