in harness/curl.js [894:934]
function getDep (name, index) {
var resolveOnce, exportOnce, childDef, earlyExport;
resolveOnce = countdown(1, function (dep) {
exportOnce(dep);
resolveCollector(dep, index);
});
exportOnce = countdown(1, function (dep) {
exportCollector(dep, index);
});
// get child def / dep
childDef = core.fetchDep(name, parentDef);
// check if childDef can export. if it can, then
// we missed the notification and it will never fire in the
// when() below.
earlyExport = isPromise(childDef) && childDef.exports;
if (earlyExport) {
exportOnce(earlyExport);
}
when(childDef,
resolveOnce,
parentDef.reject,
parentDef.exports && function (msg) {
// messages are only sent from childDefs that support
// exports, and we only notify parents that understand
// exports too.
if (childDef.exports) {
if (msg == msgUsingExports) {
// if we're using exports cjs variable on both sides
exportOnce(childDef.exports);
}
else if (msg == msgFactoryExecuted) {
resolveOnce(childDef.exports);
}
}
}
);
}