Function onChange

  • 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.

    Note

    • Does not work with "target": "esnext" in tsconfig.json

    Note

    • Requires "experimentalDecorators": true in tsconfig.json

    Todo

    add example.

    Type Parameters

    • TTarget = any

    Parameters

    • fnKey: string | ((key, value, oldValue, target) => void)

      use: <MyClass>.prototype.<myFunction> or define an arrow function: (key, value, oldValue, target) => {}.

    • paramType: "object" | "param" | "void" = 'param'

      if param, the function is called with 4 parameters: key, value, oldValue, target, default for onChange if object, the function is called with an object parameter: {key, value, oldValue, target}, default for onChange3 if void then no params are passed. onChange2 Default: false.

    Returns PropertyDecorator

Generated using TypeDoc