Git Product home page Git Product logo

storage.js's Introduction

Storage.js

对localStorage本地存储方案的兼容封装及扩展,主要让费如下:

set(key, value, expires)

存储键值对,需指定key和对应的value。expires为可选参数(单位毫秒),用于控制set成功后的自动过期时间。

get(key)

获取storage中保存的key对应的value。

remove(key, value)

移除storage中对应key的存储。若原存储值为数组, 则可通过value来指定需移除的数组元素。

add(key, value, options)

把指定key对应的storage看作一个数组,往其中添加value。可选参数options有两个选项: type 规定该储值数组的类型(默认是没有特别约束的list, 也可设为其中规范数组对象不重复的set类型); limit 指代储值数组的最大容量(默认size为10)。

Storage.js 依赖了jqueryjson2,如有必要,可以自行根据源码封装对应方法,解除依赖。

storage.js's People

Contributors

hustkiwi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.