unwatch
Annotation for unwatching changes to a property and a getter
When used as an annotation:
- Combine with
@observable,@computedor@nested(and their variants) to stop watching changes. - You cannot re-enable watching once
@unwatchis specified.
When used as a function:
- Runs a piece of code without changes being detected by Watcher.
unwatch(() => (model.field = "value"));
- Warning: When used inside a transaction, it only becomes 'watching' when the outermost transaction completes.
runInAction(() => {unwatch(() => {// isWatching === false});// isWatching === FALSE <-- already in a transactionunwatch(() => {// isWatching === false});});// isWatching === TRUE
Call Signature
Section titled “Call Signature”unwatch(
action):void
Defined in: watcher.ts:97
Parameters
Section titled “Parameters”action
Section titled “action”() => void
Returns
Section titled “Returns”void
Call Signature
Section titled “Call Signature”unwatch(
target,propertyKey):void
Defined in: watcher.ts:97
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”unwatch(
value,context):void| ((this:object) =>any)
Defined in: watcher.ts:97
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”unwatch(
value,context):void|ClassAccessorDecoratorResult<object,any>
Defined in: watcher.ts:97
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”unwatch(
value,context):any
Defined in: watcher.ts:97
Parameters
Section titled “Parameters”undefined
context
Section titled “context”ClassFieldDecoratorContext<object, any>
Returns
Section titled “Returns”any