36 lines
766 B
JavaScript
36 lines
766 B
JavaScript
getJasmineRequireObj().ReportDispatcher = function() {
|
|
function ReportDispatcher(methods) {
|
|
|
|
var dispatchedMethods = methods || [];
|
|
|
|
for (var i = 0; i < dispatchedMethods.length; i++) {
|
|
var method = dispatchedMethods[i];
|
|
this[method] = (function(m) {
|
|
return function() {
|
|
dispatch(m, arguments);
|
|
};
|
|
}(method));
|
|
}
|
|
|
|
var reporters = [];
|
|
|
|
this.addReporter = function(reporter) {
|
|
reporters.push(reporter);
|
|
};
|
|
|
|
return this;
|
|
|
|
function dispatch(method, args) {
|
|
for (var i = 0; i < reporters.length; i++) {
|
|
var reporter = reporters[i];
|
|
if (reporter[method]) {
|
|
reporter[method].apply(reporter, args);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return ReportDispatcher;
|
|
};
|
|
|