Using observerLocator
The Observer Locator API allows you to watch properties in your components for changes without the need for using the @observable
decorator. In most cases, manual observation will not be required using this API, but it is there if you want it.
By default, an observer locator is used to create observers and subscribe to them for change notification.
A basic observer has the following interface:
The subscribe
method of an observer can be used to subscribe to the changes that it observes. This method takes a subscriber as its argument.
A basic subscriber has the following interface:
An observer of an object property can be retrieved using an observer locator.
An example of this is:
And to subscribe to changes emitted by this observer:
Last updated
Was this helpful?