@nevware21/ts-utils
    Preparing search index...

    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.

      • OptionalgetProp: () => V

        The getter function to wire against the getter.

      • OptionalsetProp: (v: V) => void

        The setter function to wire against the setter.

      • Optionalconfigurable: boolean

        Can the value be changed, defaults to true

      • Optionalenumerable: boolean

        Should this get property be enumerable, defaults to true.

      Returns T

      The object that was passed to the function

      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.