Created
December 22, 2014 16:10
-
-
Save odoe/65b6f063123c1397f8e5 to your computer and use it in GitHub Desktop.
Sample of how to use PouchDBStore with FeatureLayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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