browser-localstorage-expire
v1.8.1
Published
package for manage localstorage browser
Downloads
233
Maintainers
Readme
browser-localStorage
Installation
npm i -S browser-localstorage-expire
yarn add browser-localstorage-expire
Usage
Returns: methods getItem and saveItem
Example
const localCache = browserLocalstorage();
browserLocalstorage~getItem(name) ⇒
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]) ⇒
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);