x-http-client
Version:
An http client to make it easier to send requests (including JSONP requests) to the server.
20 lines (15 loc) • 441 B
JavaScript
/**
* The function to create JSONP callback name.
*
* @param {RequestOptions} options The request options.
* @returns {string} Returns the callback name.
*/
function buildCalllbackName(options) {
var callbackName;
do {
callbackName = options.jsonpCallbackName.call(null, options);
} while (callbackName in window);
window[callbackName] = null;
return callbackName;
}
module.exports = buildCalllbackName;