Socket
Book a DemoInstallSign in
Socket

@foxford/storage

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@foxford/storage

Foxford storage

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
0
Created
Source

Описание

Пакет для работы с localStorage обеспечивающий "протухание" данных по аналогии с cookie.

Пример использования

import { ExpiredStorage } from '@foxford/storage'

const Storage = new ExpiredStorage()

Storage.setItem('key', 'value', 60) // store for 1 minute
Storage.updateExpiration('key', 120) // update expiration to 2 minutes
Storage.removeItem('key')
Storage.clear()

JSON

Библиотека также добавляет возможность сохранять и читать json более удобным способом, при этом избавляет от лишнего try catch

Storage.setJson('key', { name: 'John Doe' }, 60) // store for 1 minute
Storage.getJson('key') // { name: 'John Doe' }

Keywords

foxford

FAQs

Package last updated on 18 Mar 2025

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