I'm providing an infrastructure for other developers, and i'm using Dojo for it.
In my Init function i'm using the 'require' method (of course) which one of the parameters are the callback function when all the modules have been loaded.
The problem is that the client don't want to use callbacks. He wants to call me and line after to use me (to make my Init method synchronized) - and give him the code back after we for sure finished loading our modules.
My Code
<script src=..../dojo.js></script>
function Init()
{
var loaded = false;
require(["...myFiles..."],
function()
{
loaded = true;
});
// Whatever to do here or some other way to hold till the require operation finished
while (!loaded) // :)
}
My Client side
Init();
myFiles.DoSomething();
Is it possible to do it ? To make require synchronized or do something else that waits till it's over ? To return from the init method only when the require method finished ?