Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@analytics/session-storage-utils

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@analytics/session-storage-utils

Tiny SessionStorage utility library

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

SessionStorage Utilities

A tiny sessionStorage utility library with fallbacks in 280 bytes.

This module will automatically fail back to global window storage if sessionStorage is not available.

Exposes hasSessionStorage, getItem, setItem, & removeItem functions.

See live demo.

How to install

Install @analytics/session-storage-utils from npm.

npm install @analytics/session-storage-utils

API

Below is the api for @analytics/session-storage-utils. These utilities are tree-shakable.

hasSessionStorage

Check if sessionStorage is supported

import { hasSessionStorage } from '@analytics/session-storage-utils'

if (hasSessionStorage()) {
  // Use session storage 
}

getSessionItem

Get a sessionStorage value.

import { getSessionItem } from '@analytics/session-storage-utils'

const value = getItem('item-key')

setSessionItem

Set a sessionStorage value.

import { setSessionItem } from '@analytics/session-storage-utils'

setSessionItem('item-key', 'a')

removeSessionItem

Delete a sessionStorage value.

import { removeSessionItem } from '@analytics/session-storage-utils'

removeSessionItem('item-key')

Keywords

FAQs

Package last updated on 28 Jul 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc