Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 511 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 511 Bytes

Observable

Adds the ability to monitor class properties (static and instance) for changes

Installation:

npm i @joist/observable@next
import { observe, effect } from '@joist/observable';

class AppState {
  @observe()
  accessor todos: string[] = [];

  @observe()
  accessor userName?: string;

  @effect()
  onChange(changes: Changes) {
    console.log(changes);
  }
}

const state = new AppState();

state.todos = [...state.todos, 'Build Shit'];
state.userName = 'Danny Blue'