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

Function runTimeout

code/new-context-api/public/app.js:797–821  ·  view source on GitHub ↗
(fun)

Source from the content-addressed store, hash-verified

795 }
796} ())
797function runTimeout(fun) {
798 if (cachedSetTimeout === setTimeout) {
799 //normal enviroments in sane situations
800 return setTimeout(fun, 0);
801 }
802 // if setTimeout wasn't available but was latter defined
803 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
804 cachedSetTimeout = setTimeout;
805 return setTimeout(fun, 0);
806 }
807 try {
808 // when when somebody has screwed with setTimeout but no I.E. maddness
809 return cachedSetTimeout(fun, 0);
810 } catch(e){
811 try {
812 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
813 return cachedSetTimeout.call(null, fun, 0);
814 } catch(e){
815 // 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
816 return cachedSetTimeout.call(this, fun, 0);
817 }
818 }
819
820
821}
822function runClearTimeout(marker) {
823 if (cachedClearTimeout === clearTimeout) {
824 //normal enviroments in sane situations

Callers 2

drainQueueFunction · 0.70
app.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected