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