3 ms·
Deferring javascript loading definitely makes sense when you're loading a really heavy chunk of script that doesn't need to be around immediately. I saw load ti
by vmind 15y ago
Deferring javascript loading definitely makes sense when you're loading a really heavy chunk of script that doesn't need to be around immediately. I saw load times drop from ~500-600ms to ~150ms with use of LABjs, as the server was rendering the page almost entirely (syntax highlighted client side) but the page editor component (ACE + jQuery + other dependencies) was a good ~500-600kb of javascript for the browser to parse and run, but having the edit button appear half a second or later after the page shows isn't a real problem. ACE loading a full editor as well as syntax highlighting a few 100kb of text on the page isn't a light task.
If your site is rendered client side with backbone and templating etc, then there probably aren't many gains to be had there.
- pornel 15y agobut why do you need LABjs to defer it, rather than simply `document.createElement('script')` pattern? (or `<script defer>`/`<script async>` if you're targeting latest browsers)