travis-web/app/components/job-log.js
2016-01-04 13:15:14 +01:00

39 lines
642 B
JavaScript

import Ember from 'ember';
export default Ember.Component.extend({
logBinding: 'job.log',
didInsertElement() {
return this.setupLog();
},
logDidChange: function() {
return this.setupLog();
}.observes('log'),
logWillChange: function() {
return this.teardownLog();
}.observesBefore('log'),
willDestroyElement() {
return this.teardownLog();
},
teardownLog() {
var job;
job = this.get('job');
if (job) {
return job.unsubscribe();
}
},
setupLog() {
var job;
job = this.get('job');
if (job) {
job.get('log').fetch();
return job.subscribe();
}
}
});