diff --git a/lib/torque/request.js b/lib/torque/request.js index 49e14b9..93d6b80 100644 --- a/lib/torque/request.js +++ b/lib/torque/request.js @@ -5,12 +5,13 @@ var lastCall = null; function jsonp(url, callback, options) { - options = options || { timeout: 10000 }; + options = options || {}; + options.timeout = options.timeout === undefined ? 10000: options.timeout; var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); // function name - var fnName = 'torque_' + Date.now(); + var fnName = options.callbackName || 'torque_' + Date.now(); function clean() { head.removeChild(script);