-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2ce4c17
Showing
8 changed files
with
1,691 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/dist | ||
/node_modules | ||
/yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). | ||
|
||
## 1.0.0 - 2018-01-11 | ||
### Added | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Piotr Konieczny | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Redux persist idb storage | ||
|
||
Storage adapter to use [IndexedDB] via [idb](https://www.npmjs.com/package/idb) v3 with [redux-persist](https://github.com/rt2zz/redux-persist) ripped from [idb Examples](https://github.com/jakearchibald/idb/tree/v3.0.0#keyval-store) section | ||
|
||
## Installation | ||
|
||
```sh | ||
npm install --save @piotr-cz/redux-persist-idb-storage | ||
``` | ||
or | ||
|
||
``` | ||
yarn add @piotr-cz/redux-persist-idb-storage | ||
``` | ||
|
||
## Requirements | ||
|
||
- [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) support/ polyfill | ||
|
||
## Setup | ||
|
||
Import the storage and include it in `persistConfig` when creating Redux store: | ||
|
||
```js | ||
// 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](https://github.com/jakearchibald/idb/tree/v3.0.2#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](https://github.com/jakearchibald/idb/blob/v4.0.3/changes.md#new-stuff) [proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) which are not supported in older browsers |
Oops, something went wrong.