Skip to content
/ vstore Public

manage browser storage datas 🧻 support set expire time

License

Notifications You must be signed in to change notification settings

vbeats/vstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vstore

Sponsor paypal.me/bootvue ☕☕☕

install

npm i @vbeats/vstore

use

import VStore from "vstore";

const store = new VStore("localStorage") // localStorage || sessionStorage

store.set("test", "1234");
store.set("test2", "5555", new Date().getTime() + 24 * 60 * 60 * 1000)

store.get("test")

store.getExpire("test2")  // 0:not expire ; >0:Residual expiration time ; -1:has expired

store.remove('test2')

store.removeAll()

method

set<T>(key: string, value: T, [expire: number = 0]): void : expire Millisecond timestamp || 0 not expire

get(key: string): any : return value || null

getExpire(key: string): number : // 0:not expire -1: expired >0 : Residual expiration time

remove(key: string): void : remove one item

removeAll(): void : clear storage all items

About

manage browser storage datas 🧻 support set expire time

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages