added support for dynamic callback generation for jsonp

This commit is contained in:
javi 2014-10-21 17:15:27 +02:00
parent 77816238e5
commit 42f041a02e
2 changed files with 12 additions and 0 deletions

View File

@ -50,6 +50,10 @@
return exports.torque.extend({}, a);
}
exports.torque.isFunction = function(f) {
return typeof f == 'function' || false;
}
exports.torque.isArray = function(value) {
return value && typeof value == 'object' && Object.prototype.toString.call(value) == '[object Array]';
};
@ -65,4 +69,8 @@
return !!document.createElement('canvas');
};
exports.torque.flags = {
sprites_to_images: navigator.userAgent.indexOf('Safari') === -1
}
})(typeof exports === "undefined" ? this : exports);

View File

@ -13,6 +13,10 @@
// function name
var fnName = options.callbackName || 'torque_' + Date.now();
if (torque.isFunction(fnName)) {
fnName = fnName();
}
function clean() {
head.removeChild(script);
clearTimeout(timeoutTimer);