3 ms·
This misses the main point of javascript loaders. The idea is that you take all the scripts that are not essential for immediately rendering the page, and tell
by jpadvo 15y ago
This misses the main point of javascript loaders. The idea is that you take all the scripts that are not essential for immediately rendering the page, and tell the browser that it is okay to render the page before those scripts are loaded. The point is not for those scripts to load faster -- it is to let the user see a rendered page faster.
For example, third party javascript files for social media sharing and liking buttons often take a miserable amount of time to load. Bringing them in asynchronously can dramatically improve the user experience of a site because the user doesn't have to wait for them to load before seeing the real content.
A similar reason is part of why tables are a bad layout strategy for content in HTML. Back in the day, some (all?) browsers would not render a table until everything in it had loaded. So if you put your entire page in a table, and that table had a big image, the image would block the rendering ofthe page.
That is what javascript loaders are about. Non-blocking loading of not-immediately-required resources.
- zoips 15y agoI think that misses the point of useful loaders like RequireJS or Dojo's loader. The point of those to enable developers to actually design a modular system with well thought out and declared dependencies. Without them you end up designing a system that is wholly dependent on global namespace pollution and undeclared dependencies. The fact that you get async load is almost entirely irrelevant and focusing on it screams of premature optimization (aka fail).
- benatkin 15y agoThose don't need to even be script loaders. Stitch and Browserify do the module stuff just by concatenating them into a script. They can just be module loaders or module systems.
- jpadvo 15y agoI guess saying "main point" was an unnecessary value statement. Different applications will find different aspects of loaders useful. I should have said that discussion missed the point(s) of script loaders...