browser-localstorage-expire
TypeScript icon, indicating that this package has built-in type declarations

1.8.1 • Public • Published

browser-localStorage

npm version

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);

Package Sidebar

Install

npm i browser-localstorage-expire

Weekly Downloads

26

Version

1.8.1

License

MIT

Unpacked Size

12.6 kB

Total Files

19

Last publish

Collaborators

  • colomfernando