JsPropertyDescriptor Struct

A property descriptor (https://tc39.es/ecma262/#sec-property-descriptor-specification-type): complete, or partial (the argument of Object.defineProperty).

public readonly struct JsPropertyDescriptor

Constructors

NameDescription
JsPropertyDescriptor(JsValue, JsValue, JsValue, JsPropertyDescriptorFlags)Creates a descriptor from its fields.

JsPropertyDescriptor(JsValue, JsValue, JsValue, JsPropertyDescriptorFlags)

JsPropertyDescriptor.cs

Creates a descriptor from its fields.

public JsPropertyDescriptor(JsValue value, JsValue getter, JsValue setter, JsPropertyDescriptorFlags flags)

Parameters

value JsValue
getter JsValue
setter JsValue
flags JsPropertyDescriptorFlags

Properties

NameDescription
ConfigurableGets the [[Configurable]] attribute.
EnumerableGets the [[Enumerable]] attribute.
FlagsGets the fields and the attributes.
GetterGets the [[Get]] field (undefined when absent).
IsAccessorDescriptorGets whether the descriptor is an accessor descriptor.
IsDataDescriptorGets whether the descriptor is a data descriptor.
SetterGets the [[Set]] field (undefined when absent).
ValueGets the [[Value]] field (undefined when absent).
WritableGets the [[Writable]] attribute.

Gets the [[Configurable]] attribute.

public bool Configurable { get; }

Property value

bool

Gets the [[Enumerable]] attribute.

public bool Enumerable { get; }

Property value

bool

Gets the fields and the attributes.

public JsPropertyDescriptorFlags Flags { get; }

Gets the [[Get]] field (undefined when absent).

public JsValue Getter { get; }

Property value

JsValue

IsAccessorDescriptor

JsPropertyDescriptor.cs

Gets whether the descriptor is an accessor descriptor.

public bool IsAccessorDescriptor { get; }

Property value

bool

IsDataDescriptor

JsPropertyDescriptor.cs

Gets whether the descriptor is a data descriptor.

public bool IsDataDescriptor { get; }

Property value

bool

Gets the [[Set]] field (undefined when absent).

public JsValue Setter { get; }

Property value

JsValue

Gets the [[Value]] field (undefined when absent).

public JsValue Value { get; }

Property value

JsValue

Gets the [[Writable]] attribute.

public bool Writable { get; }

Property value

bool

Methods

NameDescription
Accessor(JsValue, JsValue, bool, bool)Creates a complete accessor descriptor; the getter and the setter are functions or undefined.
Data(JsValue, bool, bool, bool)Creates a complete data descriptor.

Accessor(JsValue, JsValue, bool, bool)

JsPropertyDescriptor.cs

Creates a complete accessor descriptor; the getter and the setter are functions or undefined.

public static JsPropertyDescriptor Accessor(JsValue getter, JsValue setter, bool enumerable = false, bool configurable = true)

Parameters

getter JsValue
setter JsValue
enumerable bool
configurable bool

Returns

JsPropertyDescriptor

Data(JsValue, bool, bool, bool)

JsPropertyDescriptor.cs

Creates a complete data descriptor.

public static JsPropertyDescriptor Data(JsValue value, bool writable = true, bool enumerable = true, bool configurable = true)

Parameters

value JsValue
writable bool
enumerable bool
configurable bool

Returns

JsPropertyDescriptor