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

make.ink favicon
Weekly Pick

Your AI tattoo generator for pro-grade concepts

Leo Wade
sellfy.com favicon
Weekly Pick

A code-free online store builder to turn views into revenue. Sell digital products, subscriptions, and merch, without fees or hassle.

Maris
www.videotoblog.ai favicon
Weekly Pick

Convert videos into awesome blog posts.

Video To Blog
www.sellerpic.ai favicon
Weekly Pick

SellerPic is the all-in-one AI design platform for e-commerce

SellerPic
fastimage.ai favicon
Weekly Pick

Fast Image AI instantly transforms your photos into stunning styles like Ghibli, Sketch, and Pixar. Effortlessly control image elements and create amazing effects with just one click.

Fast AI Team
linkedinpro.daisy.so favicon
Weekly Pick

AI-powered tool that transforms casual photos into professional LinkedIn headshots instantly. No photographer needed—just upload and download.

Gabriel
crevas.ai favicon
Weekly Pick

Crevas unifies Veo 3, Sora 2, Nano Banana and more into one intuitive canvas — so filmmakers can script, prompt, and generate cinematic stories without switching tools or losing consistency.

Spark Alpha
fotominiatur.com favicon
Weekly Pick

AI Foto Edit - Text to Image & Image Edit

foto miniatur