Skip to content

xxwwp/StorageTiming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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