Skip to content

Instantly share code, notes, and snippets.

@dvberkel
Created April 24, 2013 09:33
Show Gist options
  • Save dvberkel/5450944 to your computer and use it in GitHub Desktop.
Save dvberkel/5450944 to your computer and use it in GitHub Desktop.
Exploring pouchdb
(function(Pouch){
if (!Pouch) { throw "No Pouch found!"; }
var dbName = "experiment";
var ResponseLogger = function(loggerName){
return function logResponse(err, response){
if (err) { throw err; }
console.log(loggerName + ":");
console.log(response);
};
};
Pouch.allDbs(ResponseLogger("list of dbs"));
var db = Pouch(dbName);
db.post({ msg: "Hello World" }, ResponseLogger("post message"));
db.allDocs(ResponseLogger("list of documents"));
// Pouch.destroy(dbName, ResponseLogger); // Throws an exception when active
})(Pouch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment