AnonymousObserver

class AnonymousObserver

Anonymous observer class, used by the observe function if no predefined observer class is specified. This class provides static methods to add event handlers and property change handlers.

Constructor

<T extends ManagedObject>(target: T): AnonymousObserver<T>

.target

T

The observed target instance, set by the constructor. This reference is also passed to callbacks registered using one of the static methods.


AnonymousObserver.Custom

Static method definitions for AnonymousObserver.

.addEventHandler()

(handler: (target: T, e: ManagedEvent) => void, async?: boolean, rateLimit?: number): this

Add an event handler to this anonymous observer; the handler gets invoked for each event that is emitted on the target object, either immediately or asynchronously, optionally rate limited at given interval (in ms; only if asynchronous).

.addPropertyEventHandler()

<K extends keyof T>(propertyName: K, handler: (target: T, value: T[K], e: ManagedEvent) => void, async?: boolean, rateLimit?: number): this

Add an event handler for given property to this anonymous observer; the handler gets invoked for each event that is emitted on the object referenced by given property, either immediately or asynchronously, optionally rate limited at given interval (in ms; only if asynchronous).

.addPropertyChangeHandler()

<K extends keyof T>(propertyName: K, handler: (target: T, value: T[K], e?: ManagedEvent) => void, async?: boolean, rateLimit?: number): this

Add a change handler for given property to this anonymous observer; the handler gets invoked each time the property value is changed OR a change event is emitted on a referenced object, either immediately or asynchronously, optionally rate limited at given interval (in ms; only if asynchronous).