window-async-local-storage
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

window-async-local-storage

npm license size

Async localStorage for browser that provides the same interface as window.localStorage.

Showcasing

🌟 Features

  • Fully compatible with window.localStorage
  • 0 dependency
  • Supports all API of AsyncStorage
  • Can use IndexedDB as backend (Work in Progress)

📗 Quick Start

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.

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:

import { getItem } from "window-async-local-storage;

localStorage.setItem("my-item", "12345");

await getItem("my-item"); // 12345

Dependencies (0)

    Dev Dependencies (11)

    Package Sidebar

    Install

    npm i window-async-local-storage

    Weekly Downloads

    3

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    33.2 kB

    Total Files

    12

    Last publish

    Collaborators

    • yinyan