MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / runTimeout

Function runTimeout

public/javascripts/socket.io.js:521–545  ·  view source on GitHub ↗
(fun)

Source from the content-addressed store, hash-verified

519 }
520 } ())
521 function runTimeout(fun) {
522 if (cachedSetTimeout === setTimeout) {
523 //normal enviroments in sane situations
524 return setTimeout(fun, 0);
525 }
526 // if setTimeout wasn't available but was latter defined
527 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
528 cachedSetTimeout = setTimeout;
529 return setTimeout(fun, 0);
530 }
531 try {
532 // when when somebody has screwed with setTimeout but no I.E. maddness
533 return cachedSetTimeout(fun, 0);
534 } catch(e){
535 try {
536 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
537 return cachedSetTimeout.call(null, fun, 0);
538 } catch(e){
539 // 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
540 return cachedSetTimeout.call(this, fun, 0);
541 }
542 }
543
544
545 }
546 function runClearTimeout(marker) {
547 if (cachedClearTimeout === clearTimeout) {
548 //normal enviroments in sane situations

Callers 2

drainQueueFunction · 0.85
socket.io.jsFile · 0.85

Calls 1

callMethod · 0.80

Tested by

no test coverage detected