I agree blocking is usually a bad idea. However I need a system to load css and js on demand, which means that you never know what js is going to be called in the callback and block seems to be is the only viable solution.
Basically what I am hoping to archive is something like this:
myWidget.init(){
dependOn(['libraryA'], 'js');
dependOn(['cssA'], 'js');
.
/* Actual initialization */
}
and maybe there is another widget also depends on libraryA and cssA
myAnotherWidget.init(){
dependOn(['libraryA', 'libraryB'], 'js');
dependOn(['cssA', 'cssB'], 'css');
/* Actual initialization */
}