1.0.0 • Published 5 years ago

@zhousibao/js-localstorage v1.0.0

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

@zhousibao/js-localstorage

Practical tool for localStorage 一个实用的 localStorage 工具

Install

Install with npm:

$ npm install --save @zhousibao/js-localstorage

Basic Usage

import LS from "@zhousibao/js-localstorage";

LS.setItem(key, value, expired); // expired => second秒数

LS.getItem(key);

LS.removeItem(key);

LS.clear();

Examples:

Create an permanent localstorage:

LS.setItem("obj", { name: "localstorage" }); //  长久有效

Create an expiring localstorage, Set the validity period for one day:

LS.setItem("obj", { name: "localstorage" }, 24 * 3600); //  有效期为1天

Remove an localstorage:

LS.removeItem("obj");

Clear all localstorage:

LS.clear();

Github

Authors

1.0.0

5 years ago