Function xsDefine
For theAttributes, specify the constants corresponding to the attributes you want to set (the others being cleared).
void xsDefine
(
scope xs .bindings .xsMachineRecord* the,
const(xs .bindings .xsSlotRecord) this_,
short id,
const(xs .bindings .xsSlotRecord) slot,
ubyte attributes
);
The xsDontDelete
, xsDontEnum
, and xsDontSet
attributes correspond to the ECMAScript DontDelete, DontEnum, and ReadOnly attributes.
By default a property can be deleted, enumerated, and set.
When a property is created, if the prototype of the instance has a property with the same name, its attributes are inherited; otherwise, by default, a property can be deleted, enumerated, and set, and can be used by scripts.
Examples
In ECMAScript:
Object .defineProperty(this, "foo", 7, { writable: true, enumerable: true, configurable: true });
In D:
machine .xsDefine(xsThis, xsID_foo, xsInteger(7), xsDefault);