redux-persist-chrome-storage
Advanced tools
Comparing version
{ | ||
"name": "redux-persist-chrome-storage", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "redux-persist storage adaptor for Chrome extensions storage API.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -9,8 +9,8 @@ # Redux Persist Chrome Storage | ||
`npm install redux-persist-chrome-storage` | ||
npm: `npm install redux-persist-chrome-storage` | ||
yarn: `yarn add redux-persist-chrome-storage` | ||
# Usage | ||
## createChromeStorage Helper (Recommended) | ||
```javascript | ||
@@ -39,27 +39,2 @@ | ||
``` | ||
## Direct Instantiation | ||
```javascript | ||
import { createStore } from 'redux' | ||
import { persistStore, persistReducer } from 'redux-persist' | ||
import ChromeStorage from 'redux-persist-chrome-storage/storage/ChromeStorage' | ||
import reducer from './reducers' | ||
// Create a ChromeStorage instance using the chrome runtime and the Sync StorageArea. | ||
const storage = new ChromeStorage(window.chrome.storage.sync, window.chrome.runtime); | ||
const config = { | ||
key: 'root', | ||
storage, | ||
}; | ||
const persistedReducer = persistReducer(config, reducer); | ||
export default () => { | ||
let store = createStore(persistedReducer) | ||
let persistor = persistStore(store) | ||
return { store, persistor }; | ||
} | ||
``` |
21360
-3.01%38
-39.68%