@interaction/storage

    1.0.2 • Public • Published

    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()
    

    Keywords

    none

    Install

    npm i @interaction/storage

    DownloadsWeekly Downloads

    2

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    7.52 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar