diff --git a/lib/torque/core.js b/lib/torque/core.js index 7d5e7f1..1d51919 100644 --- a/lib/torque/core.js +++ b/lib/torque/core.js @@ -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); diff --git a/lib/torque/request.js b/lib/torque/request.js index 93d6b80..47f82db 100644 --- a/lib/torque/request.js +++ b/lib/torque/request.js @@ -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);