Helps override default Meteor file load order.
meteor add azfx:fileloader
//Define a unique id for the file
var thisFile = new FileLoader("<UniqueFileID>");
//Define dependencies and add application code.
thisFile.loadAfter(["<OtherUniqueFileID1>" , ..."] , function(){
//application code
...
})
//file1.js
var thisFile = new FileLoader("file1.js");
thisFile.loadAfter(["file2.js" , "file3.js"] , function(){
//file1.js code
...
})
//file4.js
var thisFile = new FileLoader("file4.js");
thisFile.loadAfter(["file1.js"] , function(){
//file4.js code
...
})
In case a file is not dependent on any other files, but not vice versa, we can define an id for the file
//Define a unique id for the file
var thisFile = new FileLoader("<UniqueFileID>");
//Add application code here
...
//Let FileLoader know that this file has been loaded
thisFile.finishedLoading();
No, only those file which you want to override default load order.
Yes, call FileLoader.debug(true)
. The debug messages will be shown server or client depending on where the files are loaded.