Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Shim out setTimeout if it doesnt support arguments to the callback

Mike McGannc7381406a049
diff --git a/src/js/Worldview/Support.js b/src/js/Worldview/Support.js
index e8bcf3f3e..9dcaec5a3 100644
--- a/src/js/Worldview/Support.js
+++ b/src/js/Worldview/Support.js
@@ -56,6 +56,7 @@ Worldview.namespace("Support");
shimConsole();
checkMobile();
fixSize();
+ modernSetTimeout();
};
var init = function() {
@@ -155,6 +156,31 @@ Worldview.namespace("Support");
});
};
+ var modernSetTimeout = function() {
+ // From https://developer.mozilla.org/en-US/docs/Web/API/Window.setTimeout
+
+ // The only case where this is helpful at the moment is IE9 -- only
+ // attempt to do this in that case
+ if ( ns.BROWSER === "IE" && ns.VERSION <= 9 ) {
+
+ var __nativeST__ = window.setTimeout, __nativeSI__ = window.setInterval;
+
+ window.setTimeout = function (vCallback, nDelay /*, argumentToPass1, argumentToPass2, etc. */) {
+ var oThis = this, aArgs = Array.prototype.slice.call(arguments, 2);
+ return __nativeST__(vCallback instanceof Function ? function () {
+ vCallback.apply(oThis, aArgs);
+ } : vCallback, nDelay);
+ };
+
+ window.setInterval = function (vCallback, nDelay /*, argumentToPass1, argumentToPass2, etc. */) {
+ var oThis = this, aArgs = Array.prototype.slice.call(arguments, 2);
+ return __nativeSI__(vCallback instanceof Function ? function () {
+ vCallback.apply(oThis, aArgs);
+ } : vCallback, nDelay);
+ };
+ }
+ };
+
init();
})(Worldview.Support);