百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

dob

> 前端框架
开源

使用代理的轻量级、快速状态管理工具。

728 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

使用代理的轻量级、快速状态管理工具。

Dob Dob 是一个用于监控对象变化的工具。使用 Proxy. 在线文档。

示例

在 fiddle 上有几个 示例。这里是最简单的一个:

typescript
import { observable, observe } from "dob";

const obj = observable({ a: 1 });

observe(() => {
  console.log("obj.a has changed to", obj.a);
}); //  Use `inject` to pick stores in action, do not `new UserStore()`, it's terrible for later maintenance.

## Use in react project

TypeScript import { Action, observable, combineStores, inject } from "dob"; import { Provider, Connect } from "dob-React"; @observable export class UserStore { name = "bob"; } export class UserAction { @Inject(UserStore) userStore: UserStore; @Action setName() { this.userStore.name = "lucy"; } }

@连接 class App extends React.Component { render() { return ( {this.props.UserStore.name} ); } } ReactDOM.render() , document.getElementById("React-dom") );

…

TypeScript class A { @inject(B) b; } class B { @inject(A) a; }


### Do not deconstruct to the last level on dynamic object

TypeScript const obj = observable({ a: 1 }); // 很好 obj.a = 5; // 错误 let { a } = obj; a = 5;

## 受到启发
* [mobx](https://github.com/mobxjs/mobx)
* [nx-js](https://github.com/nx-js/observer-util)

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptdobdynamicdynamic-objectobservable

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架