Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ccjoe/store.js
封装localstorage的api,并引入expires
https://github.com/ccjoe/store.js
Last synced: 18 days ago
JSON representation
封装localstorage的api,并引入expires
- Host: GitHub
- URL: https://github.com/ccjoe/store.js
- Owner: ccjoe
- Created: 2015-11-27T08:32:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-04-17T03:27:22.000Z (almost 7 years ago)
- Last Synced: 2025-01-20T20:05:12.263Z (19 days ago)
- Language: HTML
- Size: 220 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## store :
object
**Kind**: global namespace* [store](#store) :
object
* [.each(callback)](#store.each)
* [.expired(key)](#store.expired) ⇒
* [.get(key)](#store.get) ⇒
* [.del(key)](#store.del) ⇒
* [.clear(key)](#store.clear) ⇒
* [.clean(key)](#store.clean) ⇒
* [.has(key)](#store.has) ⇒
* [.size(unit)](#store.size) ⇒### store.each(callback)
遍历 store**Kind**: static method of [
store
](#store)| Param | Type | Description |
| --- | --- | --- |
| callback |function
| 参数为key, val(过期key的val在localstorage有 值,但取值会为空) |### store.expired(key) ⇒
判断key是否过期,没有返回key的值,过期返回false**Kind**: static method of [
store
](#store)
**Returns**: expired| Param | Type |
| --- | --- |
| key |string
|### store.get(key) ⇒
通过key获取store的value值(不包含过期的)**Kind**: static method of [
store
](#store)
**Returns**: vaule || object| Param | Type | Description |
| --- | --- | --- |
| key |string
| 可以为string或空,为空时取所有的localstorage |### store.del(key) ⇒
删除store某个key及值**Kind**: static method of [
store
](#store)
**Returns**: store| Param | Type | Description |
| --- | --- | --- |
| key |string
| string |### store.clear(key) ⇒
清除所有store存储**Kind**: static method of [
store
](#store)
**Returns**: store| Param | Type | Description |
| --- | --- | --- |
| key |string
| string |### store.clean(key) ⇒
清除所有已过期的store存储, 运行时即执行**Kind**: static method of [
store
](#store)
**Returns**: store| Param | Type | Description |
| --- | --- | --- |
| key |string
| string |### store.has(key) ⇒
判断某key是否存在**Kind**: static method of [
store
](#store)
**Returns**: boolean| Param | Type | Description |
| --- | --- | --- |
| key |string
| string |### store.size(unit) ⇒
获取store已存储的大小**Kind**: static method of [
store
](#store)
**Returns**: int| Param | Type | Description |
| --- | --- | --- |
| unit |string
| 单位默认返回bytes,可以为KB, MB; |## Licence ##
The MIT License
Copyright (c) 2015 Joe github.com@ccjoe