What is a script loader?
- The code can be loaded and saved and then executed later.
- Script loaders allow you to load your scripts either asynchronously (at the same time) or synchronously (one after another.)
Arguments against script loaders
There are some arguments that could be voiced against script loaders. This could include:
- Script loaders require additional client-side code just to load more code. The more client-side code there is on a page, the longer it takes to load. This doesn't even take the hit to the web server into account.
- Production Client-side code should be compressed into as few files as possible to maximize load times. Using a loader encourages more files, not less.
- Good developers will not use too many global functions and variables, but will only execute functions as they are needed, so the ability to grab code and execute it later may not be that big of a deal.
There is an argument that the new HTML5 specifications should include the ability to group scripts and to chose whether they load synchronously or asynchronously. It's a nice thought, but we should be realistic about how long it could take to actually get something like that to a point where browsers are actually supporting it. We all know that there are certain browsers out there who still don't even come close to supporting the current HTML specifications.
There are definitely some uses for script loaders, but I don't think the use of them or the lack of them is going to make or break a web application anytime soon.
Subscribe to Tyson Cadenhead
Get the latest posts delivered right to your inbox