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

Independent audiophile gear reviews with a transparent scoring system, plus 16 free in-browser audio tools.

CurateClick favicon

getfacereport.com

Private face analysis with personalized style guidance and hairstyle previews.

CurateClick favicon

lovableapp.org

Discover beautiful apps built with vibe coding

CurateClick favicon

antiquescanner.org

Identify antiques, vintage items and collectibles from photos, with estimated market value.

CurateClick favicon

imagelayered.com

AI-powered image decomposition tool that transforms flat images into editable layers.

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.