https://github.com/yinyanfr/window-async-local-storage
Async localStorage for browser
https://github.com/yinyanfr/window-async-local-storage
Last synced: 3 months ago
JSON representation
Async localStorage for browser
- Host: GitHub
- URL: https://github.com/yinyanfr/window-async-local-storage
- Owner: yinyanfr
- License: mit
- Created: 2023-01-10T14:05:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-12T14:02:32.000Z (almost 2 years ago)
- Last Synced: 2025-03-28T21:02:42.449Z (4 months ago)
- Language: TypeScript
- Homepage: https://yinyanfr.github.io/window-async-local-storage/
- Size: 2.5 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# window-async-local-storage
[](https://www.npmjs.com/package/window-async-local-storage)

Async localStorage for browser that provides the same interface as window.localStorage.
[Showcasing](https://yinyanfr.github.io/window-async-local-storage/)
## :star2: Features
- Fully compatible with window.localStorage
- 0 dependency
- Supports all API of [AsyncStorage](https://react-native-async-storage.github.io/async-storage/docs/api)
- Can use IndexedDB as backend (Work in Progress)## :green_book: Quick Start
```js
import AsyncLocalStorage from 'window-async-local-storage';
// import { getItem, setItem, removeItem, clear } from "window-async-local-storage";await asyncLocalStorage.getItem('my-item');
await asyncLocalStorage.setItem('my-item', 12345);
await asyncLocalStorage.removeItem('my-item');
await asyncLocalStorage.clear();
```For more API please refer to [AsyncStorage](https://react-native-async-storage.github.io/async-storage/docs/api).
Please note that callbacks are not implemented as it is marked as legacy for AsyncStorage as well.
Can be used with `window.localStorage` at the same time:
```js
import { getItem } from "window-async-local-storage;localStorage.setItem("my-item", "12345");
await getItem("my-item"); // 12345
```