Created
April 24, 2013 09:33
-
-
Save dvberkel/5450944 to your computer and use it in GitHub Desktop.
Exploring pouchdb
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
(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