1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

Fix polling system

This commit is contained in:
Markus Grigull 2015-10-08 11:33:31 +02:00
parent 7fdd3e9259
commit 58bef235e1
3 changed files with 21 additions and 12 deletions

View file

@ -3,13 +3,5 @@ import DS from 'ember-data';
export default DS.Model.extend({
type: DS.attr('string'),
properties: DS.hasMany('property'),
/*poll: function() {
var _this = this;
Ember.run.later( function() {
_this.reload();
_this.poll();
}, 1000);
}.on('didLoad')*/
properties: DS.hasMany('property')
});

View file

@ -3,5 +3,22 @@ import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.findAll('entity');
},
afterModel() {
// first time call poll
Ember.run.later(this, function() {
this.refreshEntities();
}, 500);
},
refreshEntities: function() {
// fetch new data from server
this.store.findAll('entity');
// reschedule refresh
Ember.run.later(this, function() {
this.refreshEntities();
}, 500);
}
});

View file

@ -38,11 +38,11 @@ module.exports = function(environment) {
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV.APP.API_HOST = 'http://localhost:4200';
//ENV.APP.API_HOST = 'http://localhost:4200';
ENV['ember-cli-mirage'] = {
enabled: true
//enabled: false
//enabled: true
enabled: false
}
}