You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The important part of the code is in www/index.html:
<scriptsrc="js/pouchdb-6.1.2.js"></script><scriptsrc="js/pouchdb.cordova-sqlite-2.0.2.js"></script><script>document.addEventListener('deviceready',function(){vardb=newPouchDB('database.db',{adapter: 'cordova-sqlite'});db.post({}).then(function(res){returndb.get(res.id);}).then(function(doc){alert('stored a document! '+JSON.stringify(doc));alert('adapter is: '+db.adapter);alert('SQLite plugin is installed?: '+(!!window.sqlitePlugin));}).catch(console.log.bind(console));});</script>
I also added cordova-plugin-sqlite-2 to config.xml, which is why it gets installed when you run cordova prepare.
Building
This demo uses a slightly older version of Cordova, so to run it you'll need to do:
npm install -g cordova@6.2.0
Then check out the code from GitHub, then do:
cordova platform add ios@4.0.0
cordova prepare
cordova run ios
You should see:
About
Demo of using pouchdb-adapter-cordova-sqlite in an Ionic 1 project (note: PouchDB v6, Ionic v1)