From f438da2fb543ac06499aeb72701756b2fbd85b53 Mon Sep 17 00:00:00 2001 From: Eray Hanoglu Date: Tue, 28 Aug 2018 12:16:02 +0300 Subject: [PATCH] Call constructor of ES6 classes ES6 classes has constructor except initializer. Added calling constructor() of ES6 classes. --- src/aggregation-es6.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/aggregation-es6.js b/src/aggregation-es6.js index 0701859..4c768dd 100644 --- a/src/aggregation-es6.js +++ b/src/aggregation-es6.js @@ -34,8 +34,10 @@ var aggregation = (base, ...mixins) => { /* call mixin's initializer */ mixins.forEach((mixin) => { - if (typeof mixin.prototype.initializer === "function") - mixin.prototype.initializer.apply(this, args) + if (typeof mixin.prototype.constructor === 'function') + mixin.prototype.constructor.apply(this, args); + else if (typeof mixin.prototype.initializer === "function") + mixin.prototype.initializer.apply(this, args) }) } };