mobx-observed
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.15 • Public • Published

Overview

This library provides a decorator version of MobX onBecomeObserved and a decorator to make it more convenient.

compatibility

Supports MobX5 decorator, MobX6 decorator, and MobX6 annotation. MobX6 decorator requires initialization with makeObservable / makeAutoObservable.

APIs

onBecomeObserved

@onBecomeObserved(function(this:any){
  // // onBecomeObserved
  return () => {
    // onBecomeUnobserved
  };
}, function(this:any){
  // onBecomeUnobserved
})

observed

@observed(
  changed: ({newValue, oldValue}) => {})
  enter: ({oldValue}) => {})
  leave: ({oldValue}) => {})
)

observed.async

@observed.async(
  changed: ({newValue, oldValue}, setter) => {})
  enter: ({oldValue}, setter) => {})
  leave: ({oldValue}, setter) => {})
)

Readme

Keywords

none

Package Sidebar

Install

npm i mobx-observed

Weekly Downloads

2

Version

1.0.0-alpha.15

License

MIT

Unpacked Size

67.9 kB

Total Files

13

Last publish

Collaborators

  • norami