Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "index"

Index

Type aliases

AnyFunction

AnyFunction: (...args: any[]) => any

Type declaration

    • (...args: any[]): any
    • Parameters

      • Rest ...args: any[]

      Returns any

AnyObject

AnyObject: {}

Type declaration

FieldGetter

FieldGetter: () => unknown

Type declaration

    • (): unknown
    • Returns unknown

FieldSetter

FieldSetter: (value: unknown) => unknown

Type declaration

    • (value: unknown): unknown
    • Parameters

      • value: unknown

      Returns unknown

Handler

Handler: (param: HandlerParam) => any

Type declaration

SaveObject

SaveObject: AnyObject

Target

TargetFunction

TargetFunction: AnyFunction

TargetObject

TargetObject: AnyObject

Unwrap

Unwrap: () => void

Type declaration

    • (): void
    • Returns void

Wrapper

Functions

intercept

  • Wraps specified object's field(s)/method(s) or standalone function into new (wrapping) function that calls passed handler which eventually may run wrapped function or get/set field's value.

    author

    Denis Sikuler

    Parameters

    • target: TargetObject

      Function that should be wrapped or an object whose field(s)/method(s) will be wrapped and replaced.

    • field: string | string[]

      Name of field/method (or list of field/method names) that should be wrapped or a handler when function is passed for target parameter.

    • handler: Handler

      A function (interceptor) that should be executed when newly created function is called or get/set operation for the field is applied, or settings when function is passed for target parameter. See wrap for details.

    • Optional settings: WrapSettings

      Optional settings that will be available in handler. See wrap for details.

    Returns Unwrap

    Wrapping function when target is a function, or a function that restores original field(s)/method(s) when target is an object.

  • Parameters

    Returns Wrapper

wrap

  • Wraps specified object's field/method or standalone function into new (wrapping) function that calls passed handler which eventually may run wrapped function or get/set field's value.

    author

    Denis Sikuler

    Parameters

    • target: TargetObject

      Function that should be wrapped or an object whose field/method will be wrapped and replaced.

    • field: string

      Name of field/method that should be wrapped or a handler when function is passed for target parameter.

    • handler: Handler

      A function (interceptor) that should be executed when newly created function is called or get/set operation for the field is applied, or settings when function is passed for target parameter. When settings.after and settings.listen are false, result of handler will be returned from wrapping function.

    • Optional settings: WrapSettings

      Optional settings that will be available in handler.

    Returns Unwrap

    Wrapping function when target is a function, or a function that restores original field/method when target is an object.

  • Parameters

    Returns Wrapper

Generated using TypeDoc