ModuleA
requires ModuleB
, which requires ModuleC
, which requires ModuleA
.
I'm dealing with this through the following (in ModuleA
):
define(["ModuleD"], function (moduleD) {
var feedManager = {};
require(["ModuleB"], function (moduleB) {
feedManager.foo = moduleB.bar; // trivial example
}
return feedManager;
}
However occasionally, feedManager.foo
is not available at the time of invocation. I don't want to pepper my code with calls to "wait until this thing is available" - is there any way to force requireJS to handle this for me, or is there another pattern I should leverage?