Skip to main content

CurateClick

CurateClick favicon

proxy-web-storage

一个基于Proxy封装的JavaScript库,扩展了localStorage和sessionStorage的功能,支持直接操作Object、Array等复杂数据类型,提供数据变化监听和过期时间设置功能。

Check out proxy-web-storage on CurateClick

• Copy the embed code to showcase this product on your website

• Share on X to spread the word about this amazing tool

项目地址: https://github.com/KID-joker/proxy-web-storage文章地址: https://juejin.cn/post/7144142689594769415项目介绍: 借助proxy,扩展了web storage的功能,使用起来,更加方便快捷,也更加强大。主要功能为保持值类型不变,可直接操控Object、Array,支持监听数据变化和设置过期时间。## Features### BaseGet what you set and change array and object directly.jsimport { local, session } from 'proxy-web-storage';local.test = 'Hello proxy-web-storage'; // worksdelete local.test; // works// numberlocal.test = 0;local.test === 0; // true// booleanlocal.test = false;local.test === false; // true// undefinedlocal.test = undefined;local.test === undefined; // true// nulllocal.test = null;local.test === null; // true// objectlocal.test = { hello: 'world' };local.test.hello = 'proxy-web-storage'; // works// arraylocal.test = ['hello'];local.test.push('proxy-web-storage'); // workslocal.test.length // 2// Datelocal.test = new Date('2000-01-01T00:00:00.000Z');local.test.getTime() === 946684800000; // true// RegExplocal.test = /d(b+)d/g;local.test.test("cdbbdbsbz"); // true// functionlocal.test = function() { return 'Hello proxy-web-storage!';};local.test() === 'Hello proxy-web-storage!'; // true### Subscribelisten for changes.jsimport { local } from 'proxy-web-storage';local.on('test', function(newVal, oldVal) { console.log('test', newVal, oldVal);});local.on('test.a', function(newVal, oldVal) { console.log('test.a', newVal, oldVal);});local.test = {};// test {} undefinedlocal.test.a = 1;// test.a 1 undefined### Expiredset expires for items.jsimport { local } from 'proxy-web-storage';local.test = 'hello proxy-web-storage';local.setExpires('test', Date.now() + 10000);// after 10'slocal.test // undefined

Latest Weekly Picks

CurateClick favicon

kaigpt.ai

gpt代充:如何快速申请免手续费的充值服务?

CurateClick favicon

magiclayers.net

Magic Layers – Official Website, What It Is & How to Use

CurateClick favicon

lifepathcalculator.app

Life Path Calculator - free deterministic numerology: your number, strengths, challenges, and shareable cards.

CurateClick favicon

freeadhd.com

ADHD Test - a free, no-sign-up adult ADHD self-screening tool with instant results.

CurateClick favicon

pixmira.ai

Free AI photo editor and image generator for fast visual creation.

CurateClick favicon

pslratings.com

Free PSL Rating gives an instant AI PSL score with tier and four category breakdowns, no signup.

CurateClick favicon

gothic1remake.com

Gothic 1 Remake Guide — Release, Walkthroughs & Quests

CurateClick favicon

viralitypredictor.net

Predict video virality before you publish.