npm.io
1.1.0 • Published 5 years ago

@wit03/async-localstorage

Licence
MIT
Version
1.1.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0

forthebadge forthebadge

forthebadge forthebadge

Async LocalStorage

Async implemented localStorage library for javascript and typescript (coming soon).

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~

Keywords