On transition to a route, Make an api call, wait for the response and once you get a response, wait 5 secs and again call the same api and keep repeating this, until I exit out of the route.
So the catch here is to wait 5 secs, after getting the response, and again do the same api call. How do i achieve this in ember? I have tried polling as below, but polling doesn't suffice my requirement.
Ember.Route.extend({
model: function() {
var interval = 1000 * 60;
Ember.run.later(this, function() {
this.model().then(function(json) {
this.controller.set('model', json);
}.bind(this));
}, interval);
return Ember.$.getJSON('some api request');
},
Aucun commentaire:
Enregistrer un commentaire