pratuat
pratuat

Reputation: 125

ember calling super inside async callback

App.LoadAfterModalMixin = Ember.Mixin.create
  didInsertElement: ->
    superMethod = @_super
    modal = @.$().parents('.scrollable-modal')

    if modal.length > 0
      if modal.hasClass('in')
        # if the modal is already shown, run the method as the shown event has aleady been fired
        superMethod.call(this)
      else
        # run the method after the modal is shown
        modal.on "shown.bs.modal", =>
          superMethod.call(_this)
    else
      @_super()

Calling super method inside async bootstrap callback fails. Inspecting the object's __nextSuper yields "undefined". I am using ember 1.7.0.beta.4. What am I missing here ?

Upvotes: 1

Views: 328

Answers (1)

mixonic
mixonic

Reputation: 2703

Calling _super in an async manner is not currently supported in Ember:

https://github.com/emberjs/ember.js/issues/4632

We would like to support this use-case better. Unfortunately implementing solid _super functionality is a tricky balancing act.

Upvotes: 1

Related Questions