finds.dev← search

// the find

yanhaijing/data.js

★ 375 · JavaScript · MIT · updated Aug 2020

data.js 是带有消息通知的数据中心,我称其为会说话的数据。旨在让编程变得简单,世界变得美好。

data.js is a global observable data store for JavaScript — you set a value, subscribers get notified. It's essentially a pub/sub system with a key-value store bolted together, aimed at decoupling components through shared data rather than direct calls. The target audience is frontend devs who want reactive data without a framework.

The API surface is tiny: sub, set, get — you can learn it in five minutes. It ships with AMD, CommonJS, and global script support, which mattered a lot circa 2014. There's a real test suite run on CI, not just a demo page. The deep-copy-on-set/get design prevents accidental mutation of stored values, which is a correctness choice most similar micro-libs skip.

Last touched in 2020, and the compatibility matrix targets IE6 and Node 0.10 — this is a museum piece. Deep cloning every get and set is expensive and unnecessary in 2025; modern patterns use immutable references or structured clone only when needed. There's no TypeScript, no path-based subscriptions, and no batching — you'd outgrow it the moment you have more than a handful of keys. This problem space is now owned by Zustand, Jotai, or even plain browser CustomEvents.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →