storage-timing
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

StorageTiming doc

language: 中文文档

Introduction

StorageTiming is used to manage localStorage and sessionStorage, and can set timing for them.

Installation

npm install --save storage-timing
# or
yarn add storage-timing

Usage

import { Store } from "storage-timing";

const store = new Store();
const token = store.atom("token");
const foo = store.atom("foo");

token.set({ code: "bar" });
token.get(); // { code: "bar" }

token.remove();
token.get(); // null

// set timing. Expires after one hour, `foo.get()` returns "content" within one hour and null after one hour.
foo.set("content", Date.now() + 3600 * 1000);

Other

Welcome to the community to translate according to the Chinese document

Quote

Package Sidebar

Install

npm i storage-timing

Weekly Downloads

100

Version

1.0.7

License

MIT

Unpacked Size

22 kB

Total Files

6

Last publish

Collaborators

  • xxww