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

name-storage

v1.3.0

Published

Storage via window.name

Downloads

2,987

Readme

nameStorage


spm package Build Status Coverage Status

nameStorage 是类似 sessionStroage 的键值对数据存储工具,但是可以跨域。

nameStorage 适用于同一窗口内跨页面数据存储与传递。

技术上,nameStorage 使用 window.name 存储数据。 数据的生存周期为窗口会话的生存周期,同一个窗口可以通过 nameStorage 共享数据。

出生证明

window.name 非常有用,但不可滥用。 为了规范、简单便利、安全的使用 window.name,制造了这个模块。

更多请参考 window.name 使用规范。

使用说明

var key = "key";
var value = "value";

nameStorage.setItem(key, value);

nameStorage.getItem(key);

nameStorage.removeItem(key);

API

setItem(String key, String value)

写入数据到 nameStorage。

getItem(String key)

读取 nameStorage 存储的指定键值数据。

removeItem(String key)

删除 nameStorage 存储的指定键值数据。

clear()

清空 nameStorage 存储的数据。

valueOf()

读取 nameStorage 存储的所有数据。

toString()

返回 nameStorage 存储的数据的字符串形式。

    scheme                  nameStorage datas
      |                            |
------------           ------------------------
nameStorage:origin-name?key1=value1&key2=value2
            -----------
                 |
         window origin name

window.name 使用规范

  1. 不要直接操作 window.name
  2. 几乎所有的 window.name 操作,均应使用 nameStorage 提供的接口完成。
  3. 使用 nameStorage 传输完数据后,尽量在恰当的时机使用 removeItem() 清理对应数据。
  4. 主意:为了避免误清理其他人的数据,尽量使用 removeItem() 清理指定数据, 而不是 clear() 清空所有数据。

window.name maxlength

window.name 没有固定的长度限制,只受内存大小限制。

参考

LICENSES

MIT