私はちょうど似たようなことをしました。activate
ルートでプロパティを使用する必要があります ( http://emberjs.com/api/classes/Ember.Route.html#method_activate )。
このプル リクエストをチェックしてください: https://github.com/chrmod/rowmark/pull/2/files
いくつかの例:
App.NoteRoute = Ember.Route.extend({
activate: function() {
this.interval = setInterval(function() {
this.get('controller').set('toSave', true);
}.bind(this), 5000);
}
})
アップデート
私はあなたが間違っていることを理解しています。そのために残念。
まず、find
fromEmber Model
またはreturn を知る必要がありEmber Data
ますpromises
( http://emberjs.com/blog/2013/05/28/ember-data-0-13.html )
私はあなたがそれを実装するためにそのようなトリックを行うことができると思います:
App = Ember.Application.create({
ready: function() {
var switchboard;
setInterval(function() {
switchboard = App.Switchboard.find(switchboard_id).then(function(){
setTimeout(function(){}, 499);
});
}, 1);
}
});
まず、setInterval
これを infinity で実行するために実行しますloop
。次に、各ループの繰り返しで、 に渡されて実行されるデータを外部サーバーからロードするSwitchboard
ときに、を見つけます。この関数は単に 499ms 待ちます:)Ember data
function
then