@makeblock/broswer-storage
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

浏览器内容缓存

安装

yarn add @makeblock/broswer-storage

简单使用

默认使用 localstorage 存储。

// 引用
import bStorage from '@makeblock/broswer-storage';

// 设置值
bStorage.set(key, val);

// 获取值
const val = bStorage.get(key);

// 获取所有值
const json = bStorage.get();

// 切换存储策略
bStorage.strategy = 'cookie';

bStorage.set(key, val);

/* ------ 或者使用指定存储方式 ------- */

// 使用 cookie
bStorage.cookie.get(key);

// 使用 localstorage
bStorage.local.get(key);

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.2.29latest

Version History

VersionDownloads (Last 7 Days)Published
0.2.29
0.2.10
0.2.00
0.1.00
0.0.10

Package Sidebar

Install

npm i @makeblock/broswer-storage

Weekly Downloads

9

Version

0.2.2

License

ISC

Unpacked Size

15.6 kB

Total Files

6

Last publish

Collaborators

  • huange
  • makeblock-official