Tennessee Gibbs 0304752480 added pages to master | 6 年之前 | |
---|---|---|
.. | ||
dist | 6 年之前 | |
lib | 6 年之前 | |
typings | 6 年之前 | |
.babelrc | 6 年之前 | |
.eslintrc | 6 年之前 | |
.jscsrc | 6 年之前 | |
.jshintrc | 6 年之前 | |
.npmignore | 6 年之前 | |
.travis.yml | 6 年之前 | |
LICENSE | 6 年之前 | |
README.md | 6 年之前 | |
bower.json | 6 年之前 | |
package.json | 6 年之前 | |
rollup.config.es6.js | 6 年之前 | |
rollup.config.js | 6 年之前 | |
rollup.config.test.js | 6 年之前 | |
rollup.config.umd.js | 6 年之前 |
SQLite driver for Cordova apps using localForage.
cordova plugin add https://github.com/litehelpers/Cordova-sqlite-storage.git
npm i --save localforage localforage-cordovasqlitedriver
(ionic 2 users might prefer ths one)bower install --save localforage localForage-cordovaSQLiteDriver
Reduce driver size (almost by 50%) by "inheriting" the method implementations of the localforage.WEBSQL
driver.
Add support for newer versions of Cordova SQLite storage plugin (v0.8.x & v1.2.x).
UPGRADE WARNING: The default storage location for SQLite has changed in newer versions of Cordova SQLite storage plugin. The new "default
" location value is NOT the same as the old "default
" location and will break an upgrade for an app that was using the old default value (0) on iOS. If you are upgrading to a newer version of localForage-cordovaSQLiteDriver
you need to verify where your previous storage location was and update the location
property of the localForage database. Otherwise the default is 'default'
. This is to avoid breaking the iCloud Design Guide. See here for further details.
Try using the getSerializer()
(available in localforage v1.3) as the prefered way to retrieve the serializer.
defineDriver
and setDriver
to make localForage use the cordovaSQLiteDriver.<script src="cordova.js"></script>
<script src="lib/localforage/dist/localforage.js"></script>
<script src="lib/localForage-cordovaSQLiteDriver/dist/localforage-cordovasqlitedriver.js"></script>
<script>
localforage.defineDriver(window.cordovaSQLiteDriver).then(function() {
return localforage.setDriver([
// Try setting cordovaSQLiteDriver if available,
window.cordovaSQLiteDriver._driver,
// otherwise use one of the default localforage drivers as a fallback.
// This should allow you to transparently do your tests in a browser
localforage.INDEXEDDB,
localforage.WEBSQL,
localforage.LOCALSTORAGE
]);
}).then(function() {
// this should alert "cordovaSQLiteDriver" when in an emulator or a device
alert(localforage.driver());
// set a value;
return localforage.setItem('testPromiseKey', 'testPromiseValue');
}).then(function() {
return localforage.getItem('testPromiseKey');
}).then(function(value) {
alert(value);
}).catch(function(err) {
alert(err);
});
</script>