Interface ObjDefinePropDescriptor<V>

Definition of the Property Descriptor mappings for the objDefine functions. If a descriptor has neither of value, writable, get and set keys, it is treated as a data descriptor. If a descriptor has both [value or writable] and [get or set] keys, an exception is thrown. Bear in mind that these attributes are not necessarily the descriptor's own properties. Inherited properties will be considered as well. In order to ensure these defaults are preserved, you might freeze existing objects in the descriptor object's prototype chain upfront, specify all options explicitly, or point to null with objCreate(null).

0.6.0

interface ObjDefinePropDescriptor<V> {
    c?: boolean;
    e?: boolean;
    g?(): V;
    l?: ILazyValue<V>;
    s?(value: V): void;
    v?: V;
    w?: boolean;
}

Type Parameters

  • V = any

Properties

Methods

Properties

c?: boolean

Identifies if this property should be configurable (true) when this value is set to false,

  • the type of this property cannot be changed between data property and accessor property, and
  • the property may not be deleted, and
  • other attributes of its descriptor cannot be changed (however, if it's a data descriptor with writable: true, the value can be changed, and writable can be changed to false). Defaults to true.
e?: boolean

Identifies if this property will be visible during enumeration of the properties on the corresponding object. Defaults to true.

A Lazy value instance which will be used to return the value, this will be wrapped in a getter function.

0.9.4

v?: V

data descriptor The value associated with the property. Can be any valid JavaScript value (number, object, function, etc.). Defaults to undefined.

w?: boolean

true if the value associated with the property may be changed with an assignment operator. Defaults to false.

Methods

  • A function which serves as a getter for the property, or undefined if there is no getter. When the property is accessed, this function is called without arguments and with this set to the object through which the property is accessed (this may not be the object on which the property is defined due to inheritance). The return value will be used as the value of the property. Defaults to undefined.

    Returns V

  • A function which serves as a setter for the property, or undefined if there is no setter. When the property is assigned, this function is called with one argument (the value being assigned to the property) and with this set to the object through which the property is assigned. Defaults to undefined.

    Parameters

    • value: V

    Returns void