I'd like to pull a set of data every couple of seconds (no need to discuss the pros and cons of pull vs. push here). As far as I understand ember-data
that should be done with reload
. Here is my app.js
in which I try to trigger the pull in a ready function. But it doesn't work. How can I achieve the wanted reload?
App = Ember.Application.create({
ready: function() {
setInterval(function() {
App.Switchboard.find(switchboard_id).reload
}, 2000);
}
});
App.Router.map(function() {
this.resource('switchboard', { path: '/' });
});
App.SwitchboardRoute = Ember.Route.extend({
model: function() {
return App.Switchboard.find(switchboard_id);
}
});
App.Store = DS.Store.extend({
revision: 11
});
App.Switchboard = DS.Model.extend({
name: DS.attr('string'),
});