-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
36 lines (31 loc) · 877 Bytes
/
build.js
File metadata and controls
36 lines (31 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function Build (jobName) {
EventDispatcher.call(this);
// private vars
var $this = this,
_loaded = false,
_culprits = [];
$this.isLoaded = function() {
return _loaded;
};
$this.load = function() {
$.get(CONFIG.get('BUILD_URL') + '?job=' + jobName, function(build) {
_culprits = [];
$.each(build.culprits, function(i, culprit) {
_culprits.push(culprit.fullName);
});
_loaded = true;
$this.trigger(Build.events.LOADED, {build: $this});
});
};
$this.getCulprits = function() {
if (!_loaded) {
throw new Error('Build is not loaded yet');
}
return _culprits;
};
}
Build.prototype = new EventDispatcher();
Build.prototype.constructor = Build;
Build.events = {
LOADED: 'build.loaded'
};