Not compatible with PouchDB v6.x.x
Hey
The changes in PouchDB 6 have broken the plugin. https://pouchdb.com/2016/09/05/pouchdb-6.0.0.html
Populating the cache works differently now as per the documentation: Remove db.put(doc, id, rev) Please use db.put({_id: id, _rev: rev, data: 'foo'}) instead
Thanks!
Can you send a pull request instead?
Here how I changed L.TileLayer.PouchDBCached,js for pouchDb 6.0.7 form line 155:
var doc = {_id: tileUrl, dataUrl: dataUrl, timestamp: Date.now()};
if (existingRevision) {
this._db.get(tileUrl).then( function(doc) {
return this._db.put({
_id: doc._id,
_rev: doc._rev,
dataUrl: dataUrl,
timestamp: Date.now()
});
}).then( function(response) {
console.log('_saveTile update: ', response);
});
} else {
this._db.put(doc).then( function(doc) {
console.log('_saveTile insert: ', doc);
});
}
if (done) { done(); }
+1
+1
PR is #32
Demo update PR is #33
+1
Hmm.... PRs were not merged for one year now. If you want to use newer PouchDB versions (like PouchDB 6.x or PouchDB 7.x) check out my fork at: https://github.com/nikolauskrismer/Leaflet.TileLayer.PouchDBCached/
@nikolauskrismer How about I give you the npm privileges to publish this, and you send a PR to the main Leaflet repo to change the link for this plugin? I don't really have the time to maintain it.
@IvanSanchez: sounds great to me. I can send the PR to the leaflet repo this weekend...
@IvanSanchez: I guess you giving me the npm privileges goes first, doesn't it?
@IvanSanchez: any news on the npm privileges? I updated my repo and tested it with the new 1.3.4 version of leaflet (the plugin works fine again :-))
@IvanSanchez It would be so great if you could transfer ownership of the project to nikolauskrismer!