MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / runTimeout

Function runTimeout

code/controlled-uncontrolled/public/app.js:760–784  ·  view source on GitHub ↗
(fun)

Source from the content-addressed store, hash-verified

758 }
759} ())
760function runTimeout(fun) {
761 if (cachedSetTimeout === setTimeout) {
762 //normal enviroments in sane situations
763 return setTimeout(fun, 0);
764 }
765 // if setTimeout wasn't available but was latter defined
766 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
767 cachedSetTimeout = setTimeout;
768 return setTimeout(fun, 0);
769 }
770 try {
771 // when when somebody has screwed with setTimeout but no I.E. maddness
772 return cachedSetTimeout(fun, 0);
773 } catch(e){
774 try {
775 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
776 return cachedSetTimeout.call(null, fun, 0);
777 } catch(e){
778 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
779 return cachedSetTimeout.call(this, fun, 0);
780 }
781 }
782
783
784}
785function runClearTimeout(marker) {
786 if (cachedClearTimeout === clearTimeout) {
787 //normal enviroments in sane situations

Callers 2

drainQueueFunction · 0.70
app.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected