Decorator that redefines a property with getter and setter, and calls a function when the property is changed.
Parameters passed to the function are the property key and the new value.
Parameters
fnKey: string | ((key, value, oldValue) => void)
use: <MyClass>.prototype.<myFunction> or define an arrow function: (key, value, oldValue) => {}.
paramType: "object" | "param" | "void" = "param"
if param, the function is called with 3 parameters: key, value, oldValue, default for onChange
if object, the function is called with an object parameter: {key, value, oldValue}, default for onChange3
if void then no params are passed. onChange2
Default: false.
Returns PropertyDecorator
Note
Does not work with "target": "esnext" in tsconfig.json
Note
Requires "experimentalDecorators": true in tsconfig.json
Decorator that redefines a property with getter and setter, and calls a function when the property is changed. Parameters passed to the function are the property key and the new value.