3 ms·
This seems like just a reimplementation of AMD, a baby RequireJS
by hyperhopper 11y ago
This seems like just a reimplementation of AMD, a baby RequireJS
- agumonkey 11y agoSeems 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.
- laurencerowe 11y agoI 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.) It looks like webpack solves the first problem (http://webpack.github.io/docs/code-splitting.html http://webpack.github.io/docs/code-splitting.html) but for external unmanaged libraries they recommend scriptjs.
- andres 11y agoI'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.
- andres 11y agoLoadJS 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).