daleharvey/pouchdb — pull request #670 by howonlee (2013-04-04 13:39:21+00:00)
Title: (#589) fix phonegap/cordova adapter api not filling bug

Note that usage should be something like:

```
var database;
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
Pouch('listoutfitter', {}, function (err, db) {
if (err) {
console.log("Error while creating database: " + err)
for( var e in err) {
console.log("Error element: " + e + " -> " + err[e]);
}
return;
}
console.log("Successfully made new database");
database = db;
db.post({_id: 'doc1', title: 'Cony Island Baby' }, {}, function (err, response) {
console.log("created doc: " + response.ok);
console.log("doc id: " + response.id)
console.log("rev: " + response.rev)
})
});
};
```

Note that we must create and use the db inside an `onDeviceReady()` function, because we use websql which only becomes available to us after the `deviceready` event.

In order to test, you have to stick the tests/ folder inside of a cordova app and wrap all of webrunner.js in a function that is triggered on a `deviceready` event.