Head.js multiple cals of head.load

561 Views Asked by At

Does multiple calls of head.load syncronised?
I mean if we have code like this:

head.load('scr1.js',...,'scr8.js');
head.load('scr11.js',...,'scr18.js');
..................
head.load('scr81.js',...,'scr88.js');

Will all this js files loaded asynchronously and executed in order they are in source (i.e scr1,scr2,scr3,....scr8,scr11,scr12...)?

1

There are 1 best solutions below

0
On BEST ANSWER

head.load('scr1.js',...,'scr8.js'); will load files asyn, but execute in order. And similarly head.load('scr11.js',...,'scr18.js');. But, its not sure that what block will execute first i.e. head.load('scr1.js',...,'scr8.js'); or head.load('scr11.js',...,'scr18.js');. If you require to execute in order than load your head.load('scr11.js',...,'scr18.js'); in the callback of head.load('scr1.js',...,'scr8.js');

head.load('scr1.js',...,'scr8.js', function (){
  head.load('scr11.js',...,'scr18.js');
});