@wit03/async-localstorage

1.1.0 • Public • Published

forthebadge forthebadge

forthebadge forthebadge

Async LocalStorage

Async implemented localStorage library for javascript and typescript.

Why?

Since localStorage API is a synchronous and took so long to get or set value which is pretty annoying. Using Async LocalStorage will helps you deal with race condition.

Installation

// using
> npm install @wit03/async-localstorage
> yarn add @wit03/async-localstorage

Getting Started

  1. ES6
import { setItem, getItem } from '@wit03/async-localstorage'

//setItem
setItem(key, data).then(()=> {
    //value has been set
})
//getItem
getItem(key).then((value)=> {
    //return value data
})
  1. Module
const asyncLocalStorage = '@wit03/async-localstorage'

//setItem
asyncLocalStorage.setItem(key, data).then(()=> {
    //value has been set
})
//getItem
asyncLocalStorage.getItem(key).then((value)=> {
    //return value data
})

Contributions

feel free to create PR and also issues~

Package Sidebar

Install

npm i @wit03/async-localstorage

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

4.38 kB

Total Files

6

Last publish

Collaborators

  • wit03