Ecmascript E6 features

This section describes the small set of features Duktape borrows from the current ES6 draft ("Version: Rev 24, April 27, 2014 Draft"). These features are not fully compliant; the intent is to minimize custom features and to align with the coming ES6 specification.

Object.setPrototypeOf and Object.prototype.__proto__

Object.setPrototypeOf allows user to set the internal prototype of an object which is not supported in Ecmascript E5. The Ecmascript E6 draft also provides Object.prototype.__proto__, an accessor property (setter/getter) which provides the same functionality but is compatible with existing code base which has relied on a non-standard __proto__ property for a while. Duktape does not support the __proto__ property name in an object initializer.

These custom features can be disabled with the feature options DUK_OPT_NO_ES6_OBJECT_SETPROTOTYPEOF and DUK_OPT_NO_ES6_OBJECT_PROTO_PROPERTY.

Proxy object (subset)

The Ecmascript E6 Proxy object allows property virtualization and fine-grained access control for accessing an underlying plain object. Duktape implements a strict subset of the Proxy object from the ES6 draft (Rev 24). The following traps are implemented:

TrapImplementedNotes
getPrototypeOfno
setPrototypeOfno
isExtensibleno
preventExtensionno
getOwnPropertyDescriptorno
definePropertyno
hasyesObject.hasOwnProperty() does not invoke the trap at the moment, key in obj does
getyes
setyes
deletePropertyyes
enumerateyes
ownKeysyesObject.keys() enumerability check limitation
applyno
constructno

Limitations include:

This custom feature can be disabled with the feature option DUK_OPT_NO_ES6_PROXY.