Registry / storage / redux-persist-cordova-sqlite

redux-persist-cordova-sqlite

JSON →
library1.0.0jsnpmunverified

Storage adapter for redux-persist that uses cordova-sqlite-storage to persist Redux state in Cordova-based mobile apps. Version 1.0.0 is the current stable release; the package has low release cadence. Provides a simple sqlLiteStorage() factory that returns a storage object compatible with redux-persist's persistConfig. Alternative to redux-persist's default localStorage or AsyncStorage for Cordova apps. Requires peer dependency cordova-sqlite-storage ^4.0.0. Note: the package has not been updated since 2019 and there is no ESM support.

npm install redux-persist-cordova-sqlite
INSTALL
IMPORT
SIG · REDUX-PERSIST-CORD
R
redux-persist-cordova-sqlite
storagejavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sqlLiteStorage
import { sqlLiteStorage } from 'redux-persist-cordova-sqlite'
const sqlLiteStorage = require('redux-persist-cordova-sqlite')
Default export is not available; use named import. The package does not provide a default export, so require() returns an object with sqlLiteStorage property.
sqlLiteStorage
const { sqlLiteStorage } = require('redux-persist-cordova-sqlite')
const sqlLiteStorage = require('redux-persist-cordova-sqlite').default
CommonJS destructure is correct; do not try to access .default as no default export exists.

Shows how to configure redux-persist with the SQLite storage adapter in a Cordova app.

import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import reducer from './reducer'; import { persistStore, persistReducer } from 'redux-persist'; import { sqlLiteStorage } from 'redux-persist-cordova-sqlite'; export default () => { const persistConfig = { key: 'root', storage: sqlLiteStorage() }; const persistedReducer = persistReducer(persistConfig, reducer); let store = createStore(persistedReducer, applyMiddleware(thunk)); let persistor = persistStore(store); return { store, persistor }; };
Debug
Known issues
gotchaPackage has not been updated since 2019; compatibility with newer versions of redux-persist or cordova-sqlite-storage is not guaranteed.
fix
Test with your specific versions or consider using a more actively maintained storage adapter.
affects: >=1.0.0
gotchaRequires the cordova-sqlite-storage plugin to be installed and available in a Cordova environment; will not work in a standard browser or Node.js.
fix
Ensure you are running in a Cordova app with cordova-sqlite-storage installed via: cordova plugin add cordova-sqlite-storage
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'executeSql' of undefined
cordova-sqlite-storage is not properly initialized or the plugin is missing.
fix
Install cordova-sqlite-storage plugin and wait for deviceready event before using sqlLiteStorage.
Module not found: Can't resolve 'cordova-sqlite-storage'
Missing peer dependency cordova-sqlite-storage.
fix
Run: npm install cordova-sqlite-storage
TypeError: sqlLiteStorage is not a function
Incorrect import: using default import instead of named import.
fix
Use import { sqlLiteStorage } from 'redux-persist-cordova-sqlite' or const { sqlLiteStorage } = require('redux-persist-cordova-sqlite')
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
cordova-sqlite-storagerequiredPeer dependency required for actual SQLite database operations
Agent activity
30 hits · last 30 days
node
28
Amazon
1
Resources
redux-persist-cordova-sqlite — npm install redux-persist-cordova-sqlite · libregistry