Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hnzycfcfed/storage


https://github.com/hnzycfcfed/storage

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# 安装

---

## 通过npm安装

```bash
npm i --save @hnzycfcfed/storage
```

### 演示

---

```javascript
import storage from '@hnzycfcfed/storage';

storage.setLocal('test','testValue');
storage.getLocal('test');
storage.removeLocal('test');
storage.clearLocal();

storage.setSession('test','testValue');
storage.getSession('test');
storage.removeSeesion('test');
storage.clearSession();

if(!storage.test(window.localStorage)) {
console.log('本地存储未开启');
}

if(!storage.test(window.sessionStorage)) {
console.log('会话存储未开启');
}
```