Socket
Socket
Sign inDemoInstall

sessionstorage

Package Overview
Dependencies
5
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sessionstorage

sessionStorage API which gracefully degrades to window.name & cookies when not available


Version published
Weekly downloads
4.3K
decreased by-32.78%
Maintainers
2
Install size
50.1 kB
Created
Weekly downloads
 

Readme

Source

sessionstorage

Made by unshiftVersion npmBuild StatusDependenciesCoverage StatusIRC channel

The sessionStorage API is amazing and super useful when you need to store data temporarily in the browser. We used to abuse cookies for this, but not all the data that you want to store needs to be synced with the server. The sessionStorage API filled that gap, but unfortunately we cannot expect this API to be available and enabled in every browser context. This module provides various of fallbacks which follow the same API as sessionStorage for when it's not enabled. The following fallback's are supported:

  • window.name - Storing data in the name property of the window.
  • cookies - This doesn't really need an explanation.

Install

It's build for browserify but it should work with Node.js as well as we provide a fallback API. The module is released in the public npm registry and can be installed using:

npm install --save sessionstorage

Usage

The API is exactly the same as the DOM storage API so you can use the following methods:

  • getItem(key)
  • setItem(key, value)
  • removeItem(key)
  • clear()

So all you need to do is require the module and you're ready to go:

'use strict';

var sessionstorage = require('sessionstorage');

License

MIT

Keywords

FAQs

Last updated on 24 Apr 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc