All Projects β†’ dobjs β†’ Dob

dobjs / Dob

Licence: mit
Light and fast πŸš€ state management tool using proxy.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Dob

Observable Slim
Observable Slim is a singleton that utilizes ES6 Proxies to observe changes made to an object and any nested children of that object. It is intended to assist with state management and one-way data binding.
Stars: ✭ 178 (-75.04%)
Mutual labels:  observable, proxy
EventEmitter
Simple EventEmitter with multiple listeners
Stars: ✭ 19 (-97.34%)
Mutual labels:  observer, observable
Receiver
Swift Β΅framework implementing the Observer pattern πŸ“‘
Stars: ✭ 238 (-66.62%)
Mutual labels:  observable, observer
Ease
It's magic.
Stars: ✭ 1,213 (+70.13%)
Mutual labels:  observable, observer
state inspector
State change & method call logger. A debugging tool for instance variables and method calls.
Stars: ✭ 24 (-96.63%)
Mutual labels:  observer, observable
Oba
Observe any object's any change
Stars: ✭ 101 (-85.83%)
Mutual labels:  observable, observer
mobx-router5
Router5 integration with mobx
Stars: ✭ 22 (-96.91%)
Mutual labels:  observer, observable
Docker Nginx Image Proxy
on the fly image cropping with gravity, resize and compression microservice
Stars: ✭ 79 (-88.92%)
Mutual labels:  proxy, dynamic
react-mobx-router5
React components for routing solution using router5 and mobx
Stars: ✭ 58 (-91.87%)
Mutual labels:  observer, observable
mutation-observer
A library for idiomatic use of MutationObserver with Angular
Stars: ✭ 32 (-95.51%)
Mutual labels:  observer, observable
Utility
Assign/Partial/ReadOnly/Proxy
Stars: ✭ 31 (-95.65%)
Mutual labels:  observable, proxy
Observable
The easiest way to observe values in Swift.
Stars: ✭ 346 (-51.47%)
Mutual labels:  observable, observer
Observer Util
Transparent reactivity with 100% language coverage. Made with ❀️ and ES6 Proxies.
Stars: ✭ 905 (+26.93%)
Mutual labels:  observable, proxy
Lightweightobservable
πŸ“¬ A lightweight implementation of an observable sequence that you can subscribe to.
Stars: ✭ 114 (-84.01%)
Mutual labels:  observable, observer
Pydesignpattern
Design Pattern that described by Python, This is the source code for the book of Everybody Know Design Patterns.
Stars: ✭ 174 (-75.6%)
Mutual labels:  observer, proxy
reactive-box
1 kB effective reactive core
Stars: ✭ 19 (-97.34%)
Mutual labels:  observer, observable
ng-observe
Angular reactivity streamlined...
Stars: ✭ 65 (-90.88%)
Mutual labels:  observer, observable
React Reactive Form
Angular like reactive forms in React.
Stars: ✭ 259 (-63.67%)
Mutual labels:  observable, observer
Icaro
Smart and efficient javascript object observer, ideal for batching DOM updates (~1kb)
Stars: ✭ 568 (-20.34%)
Mutual labels:  observable, proxy
Hiproxy
πŸ›  hiproxy is a lightweight proxy tool for Front-End developers based on Node.js that supports an NGINX-like configuration. πŸ”₯
Stars: ✭ 629 (-11.78%)
Mutual labels:  proxy

Dob

Dob is a tool for monitoring object changes. Using Proxy. Online Docs.

CircleCI Status NPM Version Code Coverage

Examples

There are some demo on fiddle. Here's the simplest:

import { observable, observe } from "dob";

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

observe(() => {
  console.log("obj.a has changed to", obj.a);
}); // <Β· obj.a has changed to 1

obj.a = 2; // <Β· obj.a has changed to 2

You can enjoy the benefits of proxy, for example obj.a = { b: 5 } is effective.

Use in react component

import { Action, observable, combineStores, inject } from "dob";
import { Connect } from "dob-react";

@observable
export class UserStore {
  name = "bob";
}

export class UserAction {
  @inject(UserStore) userStore: UserStore;

  @Action
  setName() {
    this.userStore.name = "lucy";
  }
}

@Connect(
  combineStores({
    UserStore,
    UserAction
  })
)
class App extends React.Component {
  render() {
    return (
      <span onClick={this.props.UserAction.setName}>
        {this.props.UserStore.name}
      </span>
    );
  }
}

Use inject to pick stores in action, do not new UserStore(), it's terrible for later maintenance.

Use in react project

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";
  }
}

@Connect
class App extends React.Component {
  render() {
    return (
      <span onClick={this.props.UserAction.setName}>
        {this.props.UserStore.name}
      </span>
    );
  }
}

ReactDOM.render(
  <Provider
    {...combineStores({
      UserStore,
      UserAction
    })}
  >
    <App />
  </Provider>,
  document.getElementById("react-dom")
);

Project Examples

Ecosystem

  • dob-react - Connect dob to react! Here is a basic demo, and here is a demo with fractal. Quick start.
  • dob-react-devtools - Devtools for dob-react, with action and ui two way binding.
  • dob-redux - You can use both dob and Redux by using it! Enjoy the type and convenience of dob, and the ecology of Redux.

Communication

Talk to us about dob using DingDing.

Note

Dependency injection does not support circular references

Do not allow circular dependencies between store and action, It's impossible to do like this:

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

Do not deconstruct to the last level on dynamic object

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

// good
obj.a = 5;
// bad
let { a } = obj;
a = 5;

Inspired

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].