Members
es6 :boolean
When true
, the class being wrapped is class
style. Our es5 wrapper depends on calling the constructor without new
, so we have to differentiate.
Type:
- boolean
- Source
post :ConstructorHookFunction|null
As with ClassWrapSpec.pre
, this function will be applied subsequent to invoking the wrapped class's constructor.
Type:
- ConstructorHookFunction |
null
- Source
- See
- pre
pre :ConstructorHookFunction|null
When wrapping a class
based object, the pre
function will be invoked with the class's constructor arguments before the class constructor is invoked. The this
reference will be bound to null
.
Type:
- ConstructorHookFunction |
null
- Source
class Foo {
constructor(a, b, c) {
// do stuff
}
}
const spec = new ClassWrapSpec({
pre: function (...args) {
// args = [a, b, c]
}
})
const wrappedClass = class Wrapper extends Foo {
constructor() {
spec.pre.apply(null, [...arguments])
}
}