npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

storage-easy

v2.0.10

Published

storage-easy

Downloads

11

Readme

storage

项目介绍

辅助操作浏览器本地缓存

使用说明

import StoreEasy from 'storage-easy';
let easy = new StoreEasy.Cross(ns, model); //跨域共享
easy = new StoreEasy.Saber(ns, model); // 独立键
easy = new StoreEasy(ns, model); // 初始化操作

let proxy = easy.proxy;

proxy用于操作缓存数据
初始化:
  1. 声明$model 全局模型 (用于初始化 只能是object 如果不声明默认为{})
  2. easy = 'namespace' 声明模型所对应的命名空间并初始化
使用示例:
global.$model = {
   index: 0,
   person:{},
   array:[],
}
//声明命名空间并初始化StoreEasy实例easy 
easy = "mine" 
//使用数据操作代理对象
//set
proxy.person.set('name', '韩梅梅')
调用set之后更新
proxy.person.name = '李雷'
//get
proxy.person.name.get() 
or
proxy.person.get('name')
or
proxy.get('person.name')
//操作数组
proxy.array.push('item') or proxy.array.set(index, 'item')
//取值
proxy.array[index].get() or proxy.array.get(index)

//删除
proxy.delete('index')
//增长
proxy.increment('index')// index+=1
proxy.increment('index', 2)// index+=2

//获取当前模型对象
proxy.get()
可用方法:
easy
empty(): 与reset等价
get(keys): 
    param: a or a.b.c
    return: 返回缓存中指定keys对应的数据
reset(): 重置缓存
sync(): 刷新缓存到StoreEasy模型 使用其他方式操作缓存之后更新StoreEasy模型
toggle(namespace): 在不同的namespace之间切换
proxy
  delete(key):
    param: 删除指定值
  empty(): 清空当前代理数据模型
  get(key):
    param: 键值 多层键值用“.”隔开 
    return: 返回对应的数据模型
  increment(key, ?step): 自定键值+=
  isEmpty: 判断proxy是否为空 {} or [] or "" or null or undefined
  push: 数组操作方法 可使用set替代 等价于 proxy.set(size(), val)
  set(key, val):
    param: key: 设置的键 value:设置的值
  size():
    return: proxy数据长度