nci/static/js/app/stores/console.js

35 lines
669 B
JavaScript
Raw Normal View History

2015-05-07 21:55:40 +00:00
'use strict';
define([
'underscore',
'reflux', 'app/actions/build', 'app/connect'
], function(_, Reflux, BuildActions, connect) {
var Store = Reflux.createStore({
listenables: BuildActions,
output: '',
init: function() {
console.log('init builds console output');
},
onReadConsoleOutput: function(buildId) {
this.output = ''
var resourceName = 'build' + buildId,
self = this;
connect.resource(resourceName).unsubscribeAll();
connect.resource(resourceName).subscribe(function(data) {
self.output += data;
self.trigger({
name: 'Console for build #' + buildId,
data: data
});
});
}
});
return Store;
});