vitaly-t / excellent

Basic DOM Component Framework
https://vitaly-t.github.io/excellent/
MIT License
57 stars 5 forks source link

Inconsistent initialization during extension #11

Closed vitaly-t closed 6 years ago

vitaly-t commented 6 years ago

The way controllers are initialized during extension - method extend is not consistent with how this works during general binding.

Expected Behavior

Each controller on the extension list should receive onInit after all sibling controllers have been created, so inside the event such controllers can use each other, if necessary.

Actual Behavior

Each controller on the extension list is initialized right after it is created.

Steps to Reproduce

ctrl.extend('first', 'second');

Inside first controller:

ctrl.onInit = function() {
   var second = ctrl.node.controllers.second;
   // second = undefined, because controller `second` hasn't been created yet.
};

Environment

vitaly-t commented 6 years ago

Fixed in version 0.6.0.