MCPcopy
hub / github.com/moxiecode/plupload / checkLoaded

Function checkLoaded

tests/js/require.js:638–723  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

636 }
637
638 function checkLoaded() {
639 var err, usingPathFallback,
640 waitInterval = config.waitSeconds * 1000,
641 //It is possible to disable the wait interval by using waitSeconds of 0.
642 expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
643 noLoads = [],
644 reqCalls = [],
645 stillLoading = false,
646 needCycleCheck = true;
647
648 //Do not bother if this call was a result of a cycle break.
649 if (inCheckLoaded) {
650 return;
651 }
652
653 inCheckLoaded = true;
654
655 //Figure out the state of all the modules.
656 eachProp(enabledRegistry, function (mod) {
657 var map = mod.map,
658 modId = map.id;
659
660 //Skip things that are not enabled or in error state.
661 if (!mod.enabled) {
662 return;
663 }
664
665 if (!map.isDefine) {
666 reqCalls.push(mod);
667 }
668
669 if (!mod.error) {
670 //If the module should be executed, and it has not
671 //been inited and time is up, remember it.
672 if (!mod.inited && expired) {
673 if (hasPathFallback(modId)) {
674 usingPathFallback = true;
675 stillLoading = true;
676 } else {
677 noLoads.push(modId);
678 removeScript(modId);
679 }
680 } else if (!mod.inited && mod.fetched && map.isDefine) {
681 stillLoading = true;
682 if (!map.prefix) {
683 //No reason to keep looking for unfinished
684 //loading. If the only stillLoading is a
685 //plugin resource though, keep going,
686 //because it may be that a plugin resource
687 //is waiting on a non-plugin cycle.
688 return (needCycleCheck = false);
689 }
690 }
691 }
692 });
693
694 if (expired && noLoads.length) {
695 //If wait time expired, throw error of unloaded modules.

Callers 2

localRequireFunction · 0.85
newContextFunction · 0.85

Calls 7

eachPropFunction · 0.85
hasPathFallbackFunction · 0.85
removeScriptFunction · 0.85
makeErrorFunction · 0.85
breakCycleFunction · 0.85
onErrorFunction · 0.70
eachFunction · 0.70

Tested by

no test coverage detected