watch
Annotation for watching changes to a property and a getter
@watch by default unwraps boxed observables, arrays, sets, and maps — meaning it uses shallow comparison.
If you don't want this behavior, use @watch.ref instead.
@observableand@computed(and their variants) are automatically assumed to be@watched,
unless@unwatchor@unwatch.refis specified.@nested(and its variants) are considered@watchedunless@unwatchis specified.- If
@watchand@watch.refare specified for the same key (in the same inheritance chain),
the last annotation prevails.
Call Signature
Section titled “Call Signature”watch(
target,propertyKey):void
Defined in: watcher.ts:56
Parameters
Section titled “Parameters”target
Section titled “target”object
propertyKey
Section titled “propertyKey”string | symbol
Returns
Section titled “Returns”void
Call Signature
Section titled “Call Signature”watch(
value,context):void| ((this:object) =>any)
Defined in: watcher.ts:56
Parameters
Section titled “Parameters”(this: object) => any
context
Section titled “context”ClassGetterDecoratorContext
Returns
Section titled “Returns”void | ((this: object) => any)
Call Signature
Section titled “Call Signature”watch(
value,context):void|ClassAccessorDecoratorResult<object,any>
Defined in: watcher.ts:56
Parameters
Section titled “Parameters”ClassAccessorDecoratorTarget<object, any>
context
Section titled “context”ClassAccessorDecoratorContext
Returns
Section titled “Returns”void | ClassAccessorDecoratorResult<object, any>
Call Signature
Section titled “Call Signature”watch(
value,context):any
Defined in: watcher.ts:56
Parameters
Section titled “Parameters”undefined
context
Section titled “context”ClassFieldDecoratorContext<object, any>
Returns
Section titled “Returns”any
Properties
Section titled “Properties”ref:
PropertyDecorator<object> &ClassGetterDecorator<object,any> &ClassAccessorDecorator<object,any> &ClassFieldDecorator<object,any> =createWatchRef
Defined in: watcher.ts:65
Function
Annotation for watching values with identity comparison
It has no effect when combined with @nested.