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

@definejs/session-storage

v1.0.2

Published

针对应用层可以保持数据类型的会话存储工具类。

Downloads

26

Readme

SessionStorage.js

针对应用层可以保持数据类型的会话存储工具类。

sessionStorage 属性允许你访问一个 session Storage 对象。 它与 localStorage 相似,不同之处在于 localStorage 里面存储的数据没有过期时间设置, 而存储在 sessionStorage 里面的数据在页面会话结束时会被清除。 页面会话在浏览器打开期间一直保持,并且重新加载或恢复页面仍会保持原来的页面会话。 在新标签或窗口打开一个页面会初始化一个新的会话,这点和 session cookies 的运行方式不同。 应该注意的是,无论是 localStorage 还是 sessionStorage 中保存的数据都仅限于该页面的协议。

此处的 SessionStorage 设计理念为: SessionStorage 是针对多个应用的存储,每个应用都有自己独立的存储空间。 使用之前,一个应用请先配置应用的名称(通过配置 SessionStorage 模块的 name 字段)。 为防止跟别的应用名称冲突,可以加一些随机数,如当前应用名称为 kis-cloud,则可以配置为 kis-cloud-9DCA。 通过应用的名称来区分每个应用的独立的存储空间。 在每个应用中,又可以创建多个 id 不同的 SessionStorage 的实例,每个 SessionStorage 实例都有自己的存储空间。 每个 SessionStorage 实例中可以储存不同的 key 和 value。 因此,从层级上来说,结构为:web 应用 -> SessionStorage 实例 -> 键值。