Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kt3k/lepont-async-storage
Use react-native's AsyncStorage in browser, a lepont plugin
https://github.com/kt3k/lepont-async-storage
async-storage lepont react-native webview
Last synced: 3 months ago
JSON representation
Use react-native's AsyncStorage in browser, a lepont plugin
- Host: GitHub
- URL: https://github.com/kt3k/lepont-async-storage
- Owner: kt3k
- License: mit
- Created: 2020-03-24T02:54:26.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T04:22:54.000Z (8 months ago)
- Last Synced: 2024-10-24T20:06:35.265Z (3 months ago)
- Topics: async-storage, lepont, react-native, webview
- Language: TypeScript
- Homepage:
- Size: 605 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @lepont/async-storage v0.4.2
![ci](https://github.com/kt3k/lepont-async-storage/workflows/ci/badge.svg)
[![codecov](https://codecov.io/gh/kt3k/lepont-async-storage/branch/master/graph/badge.svg)](https://codecov.io/gh/kt3k/lepont-async-storage)> Async Storage Bridge for [lepont][]
You can use [AsyncStorage][] through [lepont][].
# Install
```
npm i --save lepont @react-native-community/async-storage @lepont/async-storage
```# Usage
React Native side:
```tsx
import React from 'react'
import { useBridge } from 'lepont'
import { WebView } from 'react-native-webview'
import { AsyncStorageBridge } from '@lepont/async-storage/bridge'
import AsyncStorage from '@react-native-community/async-storage'const App = () => {
const [ref, onMessage] = useRegistry(AsyncStorageBridge(AsyncStorage))return (
)
}
```Browser side:
```ts
import { setItem, getItem } from '@lepont/async-storage'await setItem('@storage_Key', { my: 'value' })
await getItem('@storage_Key') // => { my: 'value' }
```# LICENSE
MIT
[lepont]: https://github.com/kt3k/lepont
[AsyncStorage]: https://github.com/react-native-community/async-storage