LABjs :: Loading And Blocking JavaScript NuGet Package

The defining characteristic of LABjs is the ability to load all JavaScript files in parallel, as fast as the browser will allow, but giving you the option to ensure proper execution order if you have dependencies between files.

with regular <script> tags, you cannot control their loading and executing behavior reliably cross-browser.

Some new browsers will load them in parallel but execute them serially, delaying execution of a smaller (quicker loading) script in the pessimistic assumption of dependency on previous scripts. Older browsers will load and execute them one-at-a-time, completely losing any parallel loading speed optimizations and slowing the whole process drastically.

All browsers will, however, block other page resources (like stylesheets, images, etc) while these scripts are loading, which causes the rest of the page's content loading to appear much more sluggish to the user.

LABjs by contrast will load ALL the scripts in parallel, and will execute them as soon as possible, unless you express an execution order dependency in the chain by inserting .wait(). In addition, you can "couple" inline script logic to execute in the proper order in your chain as desired by passing a function to .wait(...).

It's important to realize that explicitly, separate $LAB chains operate completely independently, meaning there will be no explicit waiting for execution order between them.

NOTE: JavaScript execution is always still a single-threaded, first-come-first-served environment. Also, some browsers use internal loading queues which create implicit "blocking" on script execution between separate chains.

Also, the 'AllowDuplicates:false' config option will de-duplicate across chains, meaning chain B can be made to implicitly "wait" on chain A if chain B references a same script URL as chain A, and that script is still downloading.




Got any LABjs :: Loading And Blocking JavaScript Question?





Info

Version: 2.0.3
Author(s): Kyle Simpson (aka "getify") [email protected]
Last Update: Sunday, March 25, 2012
.NET Fiddle: Create the first Fiddle
Project Url: http://getify.github.com/LABjs
NuGet Url: https://www.nuget.org/packages/LABjs


Install
Install-Package LABjs
dotnet add package LABjs
paket add LABjs
LABjs Download (Unzip the "nupkg" after downloading)



Tags



STATS

must-have-score

avg-downloads-per-day

3

days-since-last-release

4416