Skip to main content

CurateClick

github.com favicon

stokado

Weekly Pick

stokado是一个JavaScript库,可以代理任何类storage对象,提供简洁的语法糖操作、类型序列化、监听订阅、设置过期和一次性取值等功能,兼容localStorage、sessionStorage等存储方案。

Check out stokado 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/stokado文章地址: https://juejin.cn/post/7357546247848869926项目介绍: stokado 可以代理任何类 storage 的对象,实现简洁的 getter,setter 等语法糖,序列化,监听订阅,设置过期,一次性取值等功能。#### 1. Syntax sugar通过对象方式直接操作 storage````jsconst storage = createProxyStorage(localStorage)storage.test = 'hello stokado'storage.test // 'hello stokado'delete storage.test```同时也支持 storage 的原生方法和属性:key()getItem()setItem()removeItem()clear()length。#### 2. Serializer保持值类型不变```js// numberstorage.test = 0storage.test === 0// booleanstorage.test = falsestorage.test === false// undefinedstorage.test = undefinedstorage.test === undefined// nullstorage.test = nullstorage.test === null// objectstorage.test = { hello: 'world' }storage.test.hello === 'stokado'// arraystorage.test = ['hello']storage.test.push('stokado')storage.test.length // 2// Datestorage.test = new Date('2000-01-01T00:00:00.000Z')storage.test.getTime() === 946684800000// RegExpstorage.test = /d(b+)d/gstorage.test.test('cdbbdbsbz')// functionstorage.test = function () { return 'hello stokado!'}storage.test() === 'hello stokado!'```#### 3. Subscribe监听储值的变化```jsstorage.on(key, callback)storage.once(key, callback)storage.off([[key], callback])```#### 4. Expired为指定项设置过期时间```jsstorage.setExpires(key, expires)storage.getExpires(key)storage.removeExpires(key)```#### 5. Disposable一次性取值,可用于借助 storage` 进行通信jsstorage.setDisposable(key)

Latest Weekly Picks

Predict video virality before you publish.

Virality Predictor

Powerful Motion Control AI Video Generator

Motion Control AI

PlusGO 是面向中国大陆用户的 ChatGPT Plus 代充值服务平台。使用官方 CDKey,支持支付宝和微信扫码支付,平均 2 分钟完成 Plus 开通,自 2025 年起已为超过 10,000 名用户完成充值。

www.toolcenter.ai favicon
Weekly Pick

Discover the Best AI & Productivity Tools — 1,500+ tools with honest reviews.

ToolCenter
huntereyes.net favicon
Weekly Pick

AI Eye Area Evaluation

Hunter Eyes
www.payforchat.com favicon
Weekly Pick

Subscribe to ChatGPT Plus/Pro in 1 minute — no international credit card needed.

PayForChat
happyhorseai.ai favicon
Weekly Pick

Happy Horse AI Creates Videos with Motion and Storytelling

Happy Horse
promptbuilder.cc favicon
Weekly Pick

Generate, optimize, test, and manage AI prompts in one place. Turn an idea into a ready-to-use prompt in seconds.

Prompt Builder