Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by
edited by

I didn't expect any problems with the task initially. Just loaded them one by one with cljs.loader/load until....
Until I got 'beforeLoadModuleCode called with module module2 while module module1 is loading'
First I realized that load was asynchronous and module loading wasn't actually finished when load exited. Digging goog.module.ModuleManager left me with an impression that its load() function is capable to queue new module loading until the previous one finishes loading.

My impression that the problem is that cljs.loader/load calls beforeLoadModuleCode() at the wrong moment of time. It seems that it must be called at the very begining of evaluating the module code, not before it even starts to download it as it is now, i.e., setLoaded is the last instruction of the module and beforeLoadModuleCode must be the first.
However, I'm still unsure I'm getting the whole idea behind ModuleManager correctly so I need a confirmation that I'm correct.

Please log in or register to answer this question.

...