New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dob

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dob

  • 2.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22
decreased by-58.49%
Maintainers
1
Weekly downloads
 
Created
Source

dob

Build Status

dob 利用 proxy 完整实现了 object.observer。主要为 react 提供数据流功能。可以结合 dynamic-react 以 mutable 方式为 react 组织数据流;同时也支持融合 redux,结合 mutable 与 immutable 的优势,以 mutable 方式组织 store,以 immutable 方式更新数据。

功能与 mobx 很像,同时借鉴了 nx-js 实现理念。给力的地方在于,不支持 ie11 浏览器!非常激进,核心使用 proxy,抛弃兼容性换来的是超高的性能,以及完美的动态绑定。

核心用例:

import { observable, observe } from "dob"

const dynamicObj = observable({
    a: 1
})

observe(() => {
    console.log("dynamicObj.a has changed to", dynamicObj.a) 
})
// output: dynamicObj.a has changed to 1

dynamicObj.a = 2
// output: `dynamicObj.a has changed to 2`

在线 Demo

安装

yarn add dob --save

稳定性

目前通过了 100%(53个)测试用例

功能

结合 dynamic-react

以 mutable 方式管理数据流,vm 层使用 dynamic-react,只有使用到的变量发生变动,才会触发更新!

查看 在线 Demo,支持分型的 分型 Demo

Api

observableobserve: 产生对象的代理、动态跟踪代理对象变化;dynamic-react: 将代理对象结合到 react 当中,自动、精确的更新组件;Action: 建议所有修改收敛在 action 中,且支持更新合并。

结合 dependency-inject

以依赖注入的方式管理 store 与 action,直接查看 在线 Demo,快速结合 分型 demo

结合 react-redux

支持以 mutable 方式管理数据流,但 vm 层对接到 redux,虽然以可变方式修改数据,但会自动生成不可变数据!在线 Demo

也可以 fork 本项目,npm start 就可以打开 redux todoMVC!数据层依然是 mutable。

unpkg

https://unpkg.com/dob@2.1.19/built/bundle.js

实现原理解析

FAQs

Package last updated on 03 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc