Documentation

observe

observe()

<T extends ManagedObject>(Target: ManagedObjectConstructor<T>, Observer: new (instance: T) => any): void

Implementation of ManagedObject.observe.

Example

// most common method to observe a class:
class MyComponent extends Component {
  // ... properties and methods
}
MyComponent.observe(class {
  constructor (public readonly c: MyComponent) { }
  // ... observer methods
  // (cannot include decorators!)
})

// alternative:
class MyComponentObserver {
  constructor (public readonly c: MyComponent) { }
  // ... observer methods
  // (method decorators are OK here)
}
observe(MyComponent, MyComponentObserver);