@joist/observable
TypeScript icon, indicating that this package has built-in type declarations

3.2.1 • Public • Published

Observable

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

Installation:

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

class AppState {
  @observe accessor todos: string[] = [];
  @observe accessor userName?: string;

  @effect onChange(changes: Set<string | symbol>) {
    console.log(changes);
  }
}

const state = new AppState();

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @joist/observable

      Weekly Downloads

      7

      Version

      3.2.1

      License

      MIT

      Unpacked Size

      34.5 kB

      Total Files

      31

      Last publish

      Collaborators

      • deebloo