0
结束后,在父组件调用父函数,我有以下几点:如何保证一个子组件Ember.run.later在灰烬
.
.
.
recurringFunc: function(delay, index){
.
.
.
if (someFlag){
Ember.run.later(_this, function() {
_this.send('otherFunc',{index: index});
_this.send('recurringFunc', delay, ++index);
}, delay);
}
},
otherFunc: function(somePara){
.
.
.
}
在父模板我有以下几点:
.
.
.
{{template-name someFlag=someFlag}}
.
.
.
然后在孩子componoent我有以下几点:
input: function(){
this.set('someFlag', false);
this.sendAction('otherFunc', {index: someVal});
}
当如果从触发的动作子组件,它成功地更改父项中的某个标志。但是,代码在执行从子进程发起的其他Func调用之前不会等待父进程中的最后一个迭代运行。
我有其他代码,我已经缩写,取决于Ember.run.later的最后一次迭代后运行otherFunc。
如何从子组件调用父组件函数并确保Ember.run.later在调用的子函数执行之前完成?
这与异步等待有什么关系?你甚至使用ES8?哪些函数返回承诺? – Bergi
对不起。我认为异步等待意味着别的东西。我将删除该标签。 – user2517182