1.0.0 • Published 10 months ago
@sophat/sessions v1.0.0
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/sessionsOr using yarn:
yarn add @sophat/sessionsOr using local via github
cd project_dir/packages && git clone https://github.com/pphatdev/sessions.git && npm link @sophat/sessionsUsage
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.