Skip to main content

touchstone.mixin.constructor

Home > @pebula/touchstone > Mixin > Constructor

Mixin.Constructor() function

A Decorator that marks a class instance method as a mixin constructor. The method will get invoked, with the context of the final target, when the final target is constructed and in the order the mixins are defined. The method will get the same parameters provided by the constructor.

Signature:

Constructor: <Z extends object>(target: Z extends Function ? never : Z, key: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor | void =
(target: object, key: any, descriptor: PropertyDescriptor) => {
Object.defineProperty(target.constructor, mixinCtorRef, {
value: descriptor.value,
configurable: false,
enumerable: false,
writable: false,
});
}

Parameters

Parameter

Type

Description

target

Z extends Function ? never : Z

key

string | symbol

descriptor

PropertyDescriptor

Returns:

PropertyDescriptor | void