1.0.3 • Published 3 years ago

lg-storage v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Storage

为了方便对JSAPI LocalStorage的使用,这里封装lg-storage库简化操作。

# 安装
$ yarn add lg-storage 
# OR
$ npm install lg-storage

API

/**
 * 存储数据
 * @param key 键
 * @param value 值
 */
static set(key: string, value: any): void;
/**
 * 读取数据
 * @param key 键
 * @returns
 */
static get<T = any>(key: string): T | null;
/**
 * 移除数据
 * key的类型可以为字符串、字符串数组以及undefined
 * 根据不同类型,有如下三种结果:
 * - 当key为字符串时/移除指定key对应的数据
 * - 当key为字符串数组时/遍历删除指定key对应的数据
 * - 当key为undefined时/清空所有本地数据
 * @param key
 */
static del(key?: string | string[]): void;
1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago