x-http-client
Version:
An http client to make it easier to send requests (including JSONP requests) to the server.
17 lines (14 loc) • 473 B
JavaScript
var isFunction = require('x-common-utils/isFunction');
/**
* The function to call xhr hook function.
*
* @param {XHRHookFunction} func The hook function to call, if it is not function, this hook is skipped.
* @param {XMLHttpReqeust} xhr The instance of `XMLHttpReqeust`.
* @param {RequestOption} options The request options.
*/
function callXhrHook(func, xhr, options) {
if (isFunction(func)) {
func(xhr, options);
}
}
module.exports = callXhrHook;