browser-localStorage
Installation
npm i -S browser-localstorage-expire
yarn add browser-localstorage-expire
Usage
module for manage cache from localstorage with expiration
Returns:
methods getItem and saveItem
Example
const localCache = browserLocalstorage();
browserLocalstorage~getItem(name) ⇒
function for get data in localstorage
Kind: inner method of browserLocalstorage
Returns:
data from localstorage
Param | Type | Description |
---|---|---|
name | string |
name key for localstorage |
Example
const localCache = browserLocalstorage();
localCache.localGetItem('data')
browserLocalstorage~setItem(name, value, [expiry]) ⇒
function for save data in localstorage
Kind: inner method of browserLocalstorage
Returns:
void
Param | Type | Default | Description |
---|---|---|---|
name | string |
name key for localstorage |
|
value | * |
data to save in localstorage |
|
[expiry] | number |
5 |
time of expiration in minutes |
Example
const localCache = browserLocalstorage();
localCache.setItem('data', [{ country: 2 }], 5);