allow custom callback
This commit is contained in:
parent
7a75d44eb6
commit
5347593d9d
@ -5,12 +5,13 @@
|
|||||||
var lastCall = null;
|
var lastCall = null;
|
||||||
|
|
||||||
function jsonp(url, callback, options) {
|
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 head = document.getElementsByTagName('head')[0];
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
|
|
||||||
// function name
|
// function name
|
||||||
var fnName = 'torque_' + Date.now();
|
var fnName = options.callbackName || 'torque_' + Date.now();
|
||||||
|
|
||||||
function clean() {
|
function clean() {
|
||||||
head.removeChild(script);
|
head.removeChild(script);
|
||||||
|
Loading…
Reference in New Issue
Block a user