简体   繁体   English

灰烬在异步回调中调用超级

[英]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 ". 检查对象的__nextSuper会产生“ undefined ”。 I am using ember 1.7.0.beta.4 . 我正在使用余烬1.7.0.beta.4 What am I missing here ? 我在这里想念什么?

Calling _super in an async manner is not currently supported in Ember: Ember当前不支持以异步方式调用_super

https://github.com/emberjs/ember.js/issues/4632 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. 不幸的是,实现可靠的_super功能是一个棘手的平衡行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM