@interaction/storage
v1.0.2
Published
`npm i --save @interaction/storage` ### 使用 `import storage from '@interaction/storage';` ### API #### setItem(key, value[, time]) - **key**: string - **value**: string - **time**: Date|number|string,过期时间,如果取值时间大于该值,将自动删除,并返回null, 可选
Downloads
1
Keywords
Readme
Storage
安装
npm i --save @interaction/storage
使用
import storage from '@interaction/storage';
API
setItem(key, value[, time])
- key: string
- value: string
- time: Date|number|string,过期时间,如果取值时间大于该值,将自动删除,并返回null, 可选
storage.setItem('key1', 'value1')
storage.setItem('key2', 'value2', new Date())
getItem(key) :获取指定key值对应的value值
- key: string
storage.getItem('key1')
removeItem(key) :清除指定的key值和对应的value值
- key: string
storage.removeItem('key1')
clear() :清空已存储的值
- key: string
storage.clear()