mercredi 2 juillet 2014

Is requiring a dependency in requirejs really asynchronous?


Vote count:

0




if I define a module with requireJS like this.



define(function(require){

var x = require("y");

//do something with x

});


Why is it possible to use x instantly after requiring it? I thought require collects the dependencies asynchronous? I have heard that requirejs calls toString() on the callback function and parse it to find require statements to collect the dependencies before calling the callback. Is this correct?



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire