@sophat/sessions
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Setting a Cookie

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

Sessions.setItem('key', 'value');

Getting a Cookie

const value = Sessions.getItem('key');

Updating a Cookie

Sessions.updateItem('key', 'newValue');

Removing a Cookie

Sessions.removeItem('key');

Clearing All Cookies

Sessions.clear();

Getting All Cookie Keys

const keys = Sessions.getKeys();

License

This project is licensed under the MIT License.

Package Sidebar

Install

npm i @sophat/sessions

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

9.39 kB

Total Files

6

Last publish

Collaborators

  • sophat