pouchdb / upsert

PouchDB plugin for upsert() and putIfNotExists() functions
Apache License 2.0
149 stars 25 forks source link

Please support require.js AMD loading. #12

Closed mjosephdelrosario closed 8 years ago

mjosephdelrosario commented 8 years ago

I loaded pouchdb-find just fine through AMD(require.js), but this plugin, i cant, i just returns undefined when i load it.

nolanlawson commented 8 years ago

We can do this by adding --standalone pouchdbUpsert to the browserify command. Anybody want to take this up?

nolanlawson commented 8 years ago

This is fixed in the latest release.

atiertant commented 8 years ago

@nolanlawson after loading it with requirejs =>

ContactDBService.js:42 Uncaught TypeError: db.upsert is not a function

paths: {
  'PouchDB': 'lib/pouchdb/pouchdb-5.3.2.min',
  'PouchDB-upsert': 'lib/pouchdb/pouchdb.upsert.min'
},
shim: {
  'PouchDB': {exports: 'PouchDB'},
  'PouchDB-upsert': { deps: ['PouchDB']}
}

where am i wrong?

nolanlawson commented 8 years ago

You probably also need to manually do PouchDB.plugin(PouchUpsert)