aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/service/xhr.bulk.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/service/xhr.bulk.js b/src/service/xhr.bulk.js
index 15bf0c83..2365be77 100644
--- a/src/service/xhr.bulk.js
+++ b/src/service/xhr.bulk.js
@@ -41,7 +41,9 @@ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){
}
}
bulkXHR.urls = {};
- bulkXHR.flush = function(success, error) {
+ bulkXHR.flush = function(success, errorback) {
+ assertArgFn(success = success || noop, 0);
+ assertArgFn(errorback = errorback || noop, 1);
forEach(bulkXHR.urls, function(queue, url) {
var currentRequests = queue.requests;
if (currentRequests && currentRequests.length) {
@@ -62,7 +64,7 @@ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){
$log.error(e);
}
});
- (success || noop)();
+ success();
},
function(code, response) {
forEach(currentRequests, function(request, i) {
@@ -76,12 +78,11 @@ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){
$log.error(e);
}
});
- (error || noop)();
+ noop();
});
- scope.$eval();
}
});
};
- this.$watch(bulkXHR.flush);
+ this.$watch(function(){ bulkXHR.flush(); });
return bulkXHR;
}, ['$xhr', '$xhr.error', '$log']);