Browse Source

Add onRequest callback #1736

pull/1806/head
jlukic 9 years ago
parent
commit
b8fd93ba7b
1 changed files with 5 additions and 2 deletions
  1. 7
      src/definitions/behaviors/api.js

7
src/definitions/behaviors/api.js

@ -186,13 +186,15 @@ $.api = $.fn.api = function(parameters) {
// throttle additional requests
module.timer = setTimeout(function() {
module.request = module.create.request();
module.xhr = module.create.xhr();
module.xhr = module.create.xhr();
settings.onRequest.call(context, module.request, module.xhr);
}, settings.throttle);
}
else {
// immediately on first request
module.request = module.create.request();
module.xhr = module.create.xhr();
module.xhr = module.create.xhr();
settings.onRequest.call(context, module.request, module.xhr);
}
},
@ -799,6 +801,7 @@ $.api.settings = {
beforeSend : function(settings) { return settings; },
beforeXHR : function(xhr) {},
onRequest : function(promise, xhr) {},
onSuccess : function(response, $module) {},
onComplete : function(response, $module) {},
onFailure : function(errorMessage, $module) {},

Loading…
Cancel
Save