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

weex-session

v1.1.22

Published

Weex-session is a session replacement middleware that can be used to replace local-storage, easy to use, and not to take up resources.

Downloads

2

Readme

Weex-session is a session replacement middleware that can be used to replace local-storage, easy to use, and not to take up resources.

Thanks to Zaaksam's technology sharing!

weex-session是一个session代替的中间件,可用来替换local-storage,方便使用,且不占资源。

感谢Zaaksam的技术分享!

Install

npm install weex-session --save

Usage


import session from "weex-session";

Options

  • set<T>(key: string, value: T) 设置session,需要传值的类型 set the session, need to pass the type of value
  • get<T>(key: string) 获取session get session
  • content 全部记录内容 all records
  • keys 全部记录的键值数组 All recorded array of key values
  • has(key: string) 是否存在这个key whether the existence of this key
  • del(key: string) 删除这个key delete this key
  • reset() 清空全部记录 clear all the records

Example


    session.set<string>("str", "string");
    session.set<number>("num", 100);
    this.content += "str:" + session.get("str") + "<br/>";
    this.content += "num:" + session.get("num") + "<br/>";
    this.content += "content:" + JSON.stringify(session.content()) + "<br/>";

    session.del("str");
    session.del("num");
    this.content +=
      "content is clear:" + JSON.stringify(session.content()) + "<br/>";

    session.set<string>("str", "string");
    session.set<number>("num", 200);
    this.content +=
      "content show keys:" + JSON.stringify(session.keys()) + "<br/>";
      
    session.reset();
    this.content +=
      "content is reset:" + JSON.stringify(session.content()) + "<br/>";

Result


-----------run-------------
str:string
num:100
content:{"str":"string","num":100}
content is clear:{}
content show keys:["str","num"]
content is reset:{}
-----------END run-------------

Other

生成的JS文件在dist目录中,可使用JS调用,调用方式雷同,不再重复。

The generated JS file can be called in the dist directory using the JS call, and the call is identical and no longer repeats.

Licences

[MIT]