Function editorInjection

  • Injects a function call on the decorated method. If the application is executed in runtime mode, and not in the editor. The injection is disabled and the decorator is zero-cost. In editor mode, the fnOnInvoke callback will be invoked before calling the decorated method. The fnOnDidInvoke callback will be invoked after the decorated method was invoked.

    Type Parameters

    • T

    Parameters

    • OptionalfnOnInvoke: ((self: T, args?: IArguments) => void)
        • (self, args?): void
        • Parameters

          • self: T
          • Optionalargs: IArguments

          Returns void

    • OptionalfnOnDidInvoke: ((self: T, returnValue?: any, args?: IArguments) => void)
        • (self, returnValue?, args?): void
        • Parameters

          • self: T
          • OptionalreturnValue: any
          • Optionalargs: IArguments

          Returns void

    Returns ((target: any, key: string, descriptor: PropertyDescriptor) => void)

      • (target, key, descriptor): void
      • Parameters

        • target: any
        • key: string
        • descriptor: PropertyDescriptor

        Returns void

    The this pointer will be passed as first argument. The fnOnDidInvoke method will receive the return value as second argument. The last argument for both calls is the arguments used to invoke the decorated method. It is recommend to set the this pointer type manually to enable contextual code completion.

     fnOnInvoke(self: Component, args?:IArguments)
    fnOnDidInvoke(self: Component, returnValue?:any, args?:IArguments)