astorage, 用于localStorage的微型API包装器

分享于 

3分钟阅读

GitHub

  繁體 雙語
A tiny API wrapper for localStorage
  • 源代码名称:astorage
  • 源代码网址:http://www.github.com/andrew--r/astorage
  • astorage源代码文档
  • astorage源代码下载
  • Git URL:
    git://www.github.com/andrew--r/astorage.git
    Git Clone代码到本地:
    git clone http://www.github.com/andrew--r/astorage
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/andrew--r/astorage
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    ASTORAGE

    用于安全地保存数字。数组。对象和其他数据类型的localStorage的微型API包装器。

    安装

    Astorage可以通过npm或者 Bower 获得。

    npm install astorage

    或者

    bower install astorage

    否则,你可以直接下载 zip。

    使用和 API

    // define some datavar users = [
     {
     name:'John Doe',
     age:21 },
     {
     name:'Alex Smith',
     age:35 }
    ];// save data into localStorage.// API: astorage.set(key, value)// key - string// value - string, number, array, object or anything elseastorage.set('users', users); // get value from localStorage by key.// API: astorage.get(key)// key - stringastorage.get('users');> [{name:'John Doe', age:21}, {name:'Alex Smith', age:35}]// remove item from localStorageastorage.remove('users');// or empty localStorageastorage.clear();// get localStorage items countastorage.length>0

    许可证

    在MIT许可证下发布。

    
    The MIT License (MIT)
    
    
    
    Copyright © 2015 Andrew Romanov, Kiril Osiyuk
    
    
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    
    
    of this software and associated documentation files (the"Software"), to deal
    
    
    in the Software without restriction, including without limitation the rights
    
    
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    
    
    copies of the Software, and to permit persons to whom the Software is
    
    
    furnished to do so, subject to the following conditions:
    
    
    
    The 上面 copyright notice and this permission notice shall be included in
    
    
    all copies or substantial portions of the Software.
    
    
    
    THE SOFTWARE IS PROVIDED"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    
    
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    
    
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    
    
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    
    
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    
    
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    
    
    THE SOFTWARE.
    
    
    
    

    API  WRAP  换行  LOC  Local  tiny