Function objDefineAccessors

  • Try to define get/set object property accessors for the target object/prototype, this will provide compatibility with existing API definition when run within an ES5+ container that supports accessors but still enable the code to be loaded and executed in an ES3 container, providing basic IE8 compatibility.

    Type Parameters

    • T

    • V = any

    Parameters

    • target: T

      The object on which to define the property.

    • prop: PropertyKey

      The name of the property to be defined or modified.

    • Optional getProp: (() => V)

      The getter function to wire against the getter.

        • (): V
        • Returns V

    • Optional setProp: ((v) => void)

      The setter function to wire against the setter.

        • (v): void
        • Parameters

          • v: V

          Returns void

    • Optional configurable: boolean

      Can the value be changed, defaults to true

    • Optional enumerable: boolean

      Should this get property be enumerable, defaults to true.

    Returns T

    The object that was passed to the function

    Deprecated

    It is recommended that you use objDefine instead objDefineAccessors as this internally creates the ObjDefinePropDescriptor definition based on your provided arguments. And only using a minimum set of functions reduces your overall bundle size.

Generated using TypeDoc