PouchDB Test with IndexedDB shim

by Alex

HTML

<script src="http://nparashuram.com/IndexedDBShim/indexeddb.shim.js"></script>
<script src="http://cloud.github.com/downloads/daleharvey/pouchdb/pouch.alpha.js"></script>
PouchDB Test. http://pouchdb.com/ <br/>
With IndexedDB shim. http://nparashuram.com/IndexedDBShim/

JavaScript

var pouchTest = { 
    db: {},
    create: function(){
        pouchTest.db = Pouch('idb://jsfiddle', function(err, db) {
            console.log('db created!');
            pouchTest.postData(10);
                                   
        });
    },
    postData: function(howMuch){
        howMuch = parseInt(howMuch)||0    
        for(var i=0; i<=howMuch; i++){            
            pouchTest.db.post({ title: 'Doc #'+i }, function(err, response) {
                console.log('error',err);
                console.log('response',response);
                pouchTest.showInfo();
            })
        }
    },
    showInfo: function(){
        pouchTest.db.info(function(err, info) {
            console.log('info', info);
        });
    }

    
};

pouchTest.create();