import Ember from 'ember';

export default Ember.Component.extend({
  tagName: 'li',
  childLinkViews: [],
  classNameBindings: ['active'],

  active: Ember.computed('childLinkViews.@each.active', function() {
    return Ember.A(this.get('childLinkViews')).isAny('active');
  }),

  didRender: function() {
    Ember.run.schedule('afterRender', this, function() {
      var childLinkElements = this.$('a.ember-view');

      var childLinkViews = childLinkElements.toArray().map(view =>
        this._viewRegistry[view.id]
      );

      this.set('childLinkViews', childLinkViews);
    });
  }

});
import Ember from 'ember';

export default Ember.Component.extend({
  tagName: 'li',
  classNameBindings: ['active'],

  active: Ember.computed('childLinkViews.@each.active', function() {
    return this.get('childLinkViews').isAny('active');
  }),

  init() {
    this._super( ...arguments );
    this.set('childLinkViews', Ember.A());
  },

  didRender() {
    this._super( ...arguments );
    Ember.run.schedule('afterRender', this, function() {
      let childLinkElements = this.$('a.ember-view');

      let childLinkViews = childLinkElements.toArray().map(view =>
        this._viewRegistry[view.id]
      );

      this.set('childLinkViews', Ember.A(childLinkViews));
    });
  }

});

Make 'childLinkViews' and Ember Array
Make 'childLinkViews' and Ember Array

Make the `childLinkViews` property an Ember Array, instead of having
the Computed Properties convert it (setup for future commits). This
commit includes a few other related changes;

* Create the initial array in the `init()` hook
* Run `_super()` on the `didRender()` hook
* Change `var` to `let` for variable declarations
