localstorage-expires

1.0.2 • Public • Published

localstorage-expires

给前端localStorage设置失效时间

安装

    npm i localstorage-expires --save

使用

const storage = require('localstorage-expires');
 
// 设置localStorage值, key, value 对应localStorage原始setItem 参数
// expired 为失效时间 单位 秒 
storage.setItem(key, value, expired);
 
// 与原生localStorage.getItem(key) 使用方法一致
storage.getItem(key);
 
// 与原生localStorage.removeItem(key) 使用方法一致
storage.removeItem(key);

Package Sidebar

Install

npm i localstorage-expires

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

1.96 kB

Total Files

4

Last publish

Collaborators

  • huzaihao