Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hnzycfcfed/storage
https://github.com/hnzycfcfed/storage
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hnzycfcfed/storage
- Owner: hnzycfcfed
- Created: 2022-06-23T02:27:25.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-06-23T03:13:12.000Z (over 2 years ago)
- Last Synced: 2024-09-18T02:29:02.819Z (4 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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('会话存储未开启');
}
```