Skip to content

Instantly share code, notes, and snippets.

@odoe
Created December 22, 2014 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odoe/65b6f063123c1397f8e5 to your computer and use it in GitHub Desktop.
Save odoe/65b6f063123c1397f8e5 to your computer and use it in GitHub Desktop.
Sample of how to use PouchDBStore with FeatureLayer
selectedTemplate.featureLayer.applyEdits(newAdds, null, null)
.then(function() {
db.getAll().then(function(results) {
console.debug('results', results);
var graphics = results.map(function(r) { return new Graphic(r.doc.item); });
var docs = results.map(function(r) { return r.doc; });
selectedTemplate.featureLayer.applyEdits(graphics).then(function() {
docs.map(function(doc) {
db.delete(doc);
});
});
});
}, function() {
arrayUtils.forEach(newAdds, function(x) {
db.add(x);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment