Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sophat/sessions

pphatdev18MIT1.0.0TypeScript support: included

A TypeScript utility library for managing browser session storage with a simple API. Provides methods to set, get, update, remove, and clear session storage items, plus key enumeration. Ideal for client-side state management and data persistence in web ap

sessions, session-storage, browser-storage, web-storage, typescript, storage-utility, client-side-storage, browser-sessions, storage-management, web-state, session-handler, storage-api, session-manager, key-value-storage, browser-data, state-persistence, web-sessions, session-utils, local-storage, browser-cache, storage-wrapper, session-middleware, web-utilities, client-storage, storage-helper

readme

Session Storage Utility

This project provides a set of utility functions for interacting with the browser's session storage. The Sessions class offers methods to set, get, update, remove, and clear session storage items, as well as retrieve all session storage keys.

Installation

You can install the package via npm:

npm install @sophat/sessions

Or using yarn:

yarn add @sophat/sessions

Or using local via github

cd project_dir/packages && git clone https://github.com/pphatdev/sessions.git && npm link @sophat/sessions

Usage

import { Sessions } from '@sophat/sessions';

Sessions.setItem('key', 'value');
const value = Sessions.getItem('key');
Sessions.updateItem('key', 'newValue');
Sessions.removeItem('key');

Clearing All Cookies

Sessions.clear();
const keys = Sessions.getKeys();

License

This project is licensed under the MIT License.