I provide the infrastructure for other developers, and I use Dojo for this.
In my Init function, I use the "require" method (of course), which one of the parameters is the callback function when all modules are loaded.
The problem is that the client does not want to use callbacks. He wants to call me and call to use me (to synchronize the Init method) - and return the code to him after we have surely finished loading our modules.
My code
<script src=..../dojo.js></script> function Init() { var loaded = false; require(["...myFiles..."], function() { loaded = true; });
My client side
Init(); myFiles.DoSomething();
Can this be done? To require synchronization or do something else that waits for it to end? To return from the init method only after the require? Method completes
source share