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

session-cookies

v0.1.7

Published

session-cookies is localStorage、sessionStorage、Cookies。

Downloads

12

Readme

session-cookies

session-cookies is localStorage、sessionStorage、Cookies。

npm downloads

session-cookies This plugin is used to summarize the browser's three caches localStorage, sessionStorage, Cookies.The plugin is designed to be quick and easy to use. Below is a summary of some apis.

session-cookies 这个插件是用来汇总浏览器的三个缓存 localStorage、sessionStorage、Cookies。该插件注重使用方便快捷下面是一些API汇总说明。

API

| 名称 | 获取所有 | 获取单个 | 设置单个 | 移除单个 | 清除所有 | | :-----: | :------------------: | :---------------: | :---------------: | :------------------: | :-----------------: | | cookies | getCookieList | getCookie | setCookie | removeCookie | clearCookie | | session | getAllSessionStorage | getSessionStorage | setSessionStorage | removeSessionStorage | clearSessionStorage | | local | getAllLocalStorage | getLocalStorage | setLocalStorage | removeLocalStorage | clearLocalStorage |

使用案例

npm i session-cookies
获取所有Cookies
import { cookies } from 'session-cookies'

cookies.getCookieList(); // 返回JSON结果数据
cookies.getCookie('test'); // 返回属性值
设置单个
cookies.setCookie('test', '1234567'); // 设置属性为字符串需要JSON.stringify
移除单个
cookies.removeCookie('test');
清除所有
cookies.clearCookie();

附加API

| 根据index下标获取key值 | 参数 | 结果 | | ----------------------------- | --------- | ------- | | getLocalStorageKeyFindIndex | index下标 | 返回key | | getSessionStorageKeyFindIndex | index下标 | 返回key |

使用
import { local } from 'session-cookies';

local.setLocalStorage('test', '123456');
local.setLocalStorage('usename', 'songshao');
local.getLocalStorageKeyFindIndex(0); // test
local.getLocalStorageKeyFindIndex(1); // username

Browsers


<!-- 只能使用0.1.5 以后版本 -->
<script src='https://unpkg.com/session-cookies/lib/sessionCookies.js' ></script>

<script>
    // 其他接口同上面使用只需要增加 sessionCookies 全局配置。
    sessionCookies.local.setLocalStorage('test', '123456');
</script>