dcl.prop() and dcl.Prop
Version 2.x
dcl.Prop
dcl.Prop
is a constructor function used to define a property descriptor decorator. In most cases, it is not constructed manually, but created by dcl.prop()
described below.
The constructor creates a super-simple object with one property: x
, which is an argument of the constructor. This constructor is needed solely for possible introspections with instanceof
.
dcl.prop()
dcl.prop(arg)
is a function that takes the property descriptor (described in Object.defineProperty()), and returns an instance of dcl.Prop
.
This is its full definition:
1 2 3 |
|
It is used by dcl
to mark explicitly property descriptors.
Examples
Define a property using a descriptor
1 2 3 4 5 6 7 8 9 10 11 |
|
Define a “class” using descriptors
All properties can be described as an object that contains property descriptors.
1 2 3 4 5 6 7 |
|