JSPM

@piotr-cz/redux-persist-idb-storage

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7326
  • Score
    100M100P100Q151906F
  • License MIT

Redux persist adapter for idb storage

Package Exports

  • @piotr-cz/redux-persist-idb-storage

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@piotr-cz/redux-persist-idb-storage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Redux persist idb storage

Storage adapter to use [IndexedDB] via idb v3 with redux-persist ripped from idb Examples section

Installation

npm install --save @piotr-cz/redux-persist-idb-storage

or

yarn add @piotr-cz/redux-persist-idb-storage

Requirements

Setup

Import the storage and include it in persistConfig when creating Redux store:

// configureStore.js

// using CommonJS modules
import createIdbStorage from '@piotr-cz/redux-persist-idb-storage'

// using ES6 modules
import createIdbStorage from '@piotr-cz/redux-persist-idb-storage/src'

const persistConfig = {
  key: 'root',
  storage: createIdbStorage({name: 'myApp', storeName: 'keyval'}),
  serialize: false, // Data serialization is not required and helps allows DevTools to inspect storage value
}

// ...

Options

See idb API

  • {string} name - Defaults to keyval-store
  • {string} storeName - Defaults to keyval
  • {number} version - Defaults to 1
  • {function} upgradeCallback - Defaults to upgradeDb => upgradeDb.createObjectStore(options.storeName)

Notes

  • idb dependency is locked to version ^3.0.0 as 4+ uses proxies which are not supported in older browsers