@react-native-community/async-storage-backend-web
Advanced tools
Comparing version 2.0.0-rc.0 to 2.0.0-rc.1
{ | ||
"name": "@react-native-community/async-storage-backend-web", | ||
"version": "2.0.0-rc.0", | ||
"version": "2.0.0-rc.1", | ||
"main": "build/index.js", | ||
@@ -18,3 +18,3 @@ "types": "types/index.d.ts", | ||
"dependencies": { | ||
"@react-native-community/async-storage": "^2.0.0-rc.0" | ||
"@react-native-community/async-storage": "^2.0.0-rc.1" | ||
}, | ||
@@ -30,3 +30,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "a5bf325a390f4eaadeb1a0fbfb31d629decd83df" | ||
"gitHead": "a8e83d1be5dfcf24d0d6547badb24f53cf2756f5" | ||
} |
# Storage Backend: Web | ||
// todo | ||
An AsyncStorage backend, targeting web platform. Uses either [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) or [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage). | ||
## Installation | ||
// todo | ||
```bash | ||
$ yarn add @react-native-community/async-storage@next | ||
$ yarn add @react-native-community/async-storage-backend-web@next | ||
``` | ||
## Usage | ||
// todo | ||
```typescript | ||
import WebStorage from '@react-native-community/async-storage-backend-web'; | ||
import AsyncStorageFactory from '@react-native-community/async-storage'; | ||
type MyModel = {}; | ||
const webStorage = new WebStorage(true); | ||
const storage = AsyncStorageFactory.create<MyModel>(webStorage); | ||
export default storage; | ||
``` | ||
## Options | ||
`WebStorage` accepts a single `boolean` argument, deciding if `sessionStorage` should be used instead of `localStorage`. Default is `false`. | ||
## License | ||
MIT | ||
MIT. |
17583
39