1.1.0 • Published 3 years ago

@wit03/async-localstorage v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

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~