Re:Show HN: LoadJS – A tiny async loader for modern browsers
by agumonkey on Friday July 24, 2015 @02:28PM
(#9944144)
Seems so, a good thing since there's not a lot of different implementations (I'm not very knowledgeable here).
late ps: recently ported a 2K ugly codebase (50% of global state mutation) under requirejs/AMD. It was indescribably good. Everything nicely scoped, no leakage. All of a sudden refactoring became a bliss.
Re:Show HN: LoadJS – A tiny async loader for modern browsers
by laurencerowe on Friday July 24, 2015 @02:35PM
(#9944193)
I find myself using scriptjs (on which this is based) to download browserify bundles for libraries which we don't want on every page load and also to load external API libraries which we want to fetch directly from their publisher (e.g. Mozilla Persona.)
Re:Show HN: LoadJS – A tiny async loader for modern browsers
by andres on Friday July 24, 2015 @02:55PM
(#9944331)
I'd been using $script for quite a while until I noticed that it was executing callbacks even when the dependency didn't load. After looking at the source code, I realized that it's because it was designed to work with legacy browsers that don't have onerror callbacks. Since I'm only focused on modern browsers and $script isn't maintained anymore, I wrote LoadJS to add success/fail callback support.
Re:Show HN: LoadJS – A tiny async loader for modern browsers
by andres on Friday July 24, 2015 @02:50PM
(#9944302)
LoadJS is an extremely lightweight async loader/dependency manager that is meant to be embedded on every pageload. It has a payload size of 590 bytes (minified + gzipped).
RequireJS is a fully-featured dependency manager that works in legacy browsers. It has a payload size of 6.2KB (minified + gzipped).
But for production builds I highly recommend Almond: https://github.com/jrburke/almond
late ps: recently ported a 2K ugly codebase (50% of global state mutation) under requirejs/AMD. It was indescribably good. Everything nicely scoped, no leakage. All of a sudden refactoring became a bliss.
It looks like webpack solves the first problem (http://webpack.github.io/docs/code-splitting.html) but for external unmanaged libraries they recommend scriptjs.
RequireJS is a fully-featured dependency manager that works in legacy browsers. It has a payload size of 6.2KB (minified + gzipped).