私はキューを含むサービスを持っています。このサービスを挿入するものは、サービスのキューにオブジェクトを追加できます。このキューからアイテムを非同期的に削除し、それらを実行するサービスが必要です。 service.processQueue()のような呼び出しを行う定期的な関数を持つのは良いことです。 Ember Run Loopを使用するための適切なユースケースですか? Ember.RunLoopにこれを永久に追加するにはどうしたらいいですか?Ember Run Loop Clarification
編集:http://emberjs.com/api/classes/Ember.run.html#method_schedule
run.schedule('sync', this, function() {
// this will be executed in the first RunLoop queue, when bindings are synced
console.log('scheduled on sync queue');
});
永久エンバー実行ループにこれを追加しrun.scheduleます: 私は、ドキュメントからの2つの方法が気づきましたか?何run.schedule
function sayHi() {
console.log('hi');
}
run(function() {
run.scheduleOnce('afterRender', myContext, sayHi);
run.scheduleOnce('afterRender', myContext, sayHi);
// sayHi will only be executed once, in the afterRender queue of the RunLoop
});
Plsはサンプルコードを表示しています。これは私にとって少なくとも役に立つでしょう... – kumkanillam
私はコードを持っていません。私は時間を無駄にする前に、このサービスを実装する最善の方法を理解しようとしています。 – Taztingo
@torazaburo - ありがとうございます。 scheduleOnceとscheduleの違いは何ですか? – Taztingo