Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A minimalistic Typescript plugin for web storage

NotificationsYou must be signed in to change notification settings

nixjs/web-storage

Repository files navigation

A minimalistic Typescript plugin for web storage

Install

yarn add @nixjs23n6/web-storage

Usage

New instance

import{LocalStorage,SessionStorage,WebStorage}from'@nixjs23n6/web-storage'constlocalStorage=newLocalStorage();// const sessionStorage = new SessionStorage();localStorage.setItem("ACCESS_TOKEN_KEY","ACCESS_TOKEN")localStorage.getItem<string>("ACCESS_TOKEN_KEY")

Extend

import{LocalStorage}from'@nixjs23n6/web-storage'classLocalStoreextendsLocalStorage{authorize(token:string): this{returnthis.setItem('ACCESS_TOKEN',token);}deAuthorize(): this{returnthis.removeItem('ACCESS_TOKEN');}}conststore=newLocalStore();

Static class

import{LocalStorageStatic}from'@nixjs23n6/web-storage'LocalStorageStatic.setItem("ACCESS_TOKEN_KEY","ACCESS_TOKEN")LocalStorageStatic.getItem<string>("ACCESS_TOKEN_KEY")

[8]ページ先頭

©2009-2025 Movatter.jp