Advertising sustains the DA. Ads are hidden for members. Join today

Contributed modules documentation

LABjs: Non-blocking JavaScripts

Last updated on
30 April 2025

LABjs module integrates LABjs, a JavaScript loader, used by Twitter, Vimeo, examiner.com... which loads (and executes) all scripts in parallel as fast as the browser will allow. With LABjs, your web page does not need to wait for fetching and executing JavaScript before it renders the page elements.

In general, if you want to embed your scripts, use the $LAB.queue() syntax. It's mandatory if your scripts depend on drupal.js or jQuery. Don't use the native $LAB.script() or $LAB.wait() syntax.

Don't use the document.ready() event, use Drupal behaviors instead. If you prefer to bind to an event, then bind to 'scripts-ready' (a LABjs custom event, fires when all scripts are executed) instead of 'domready'.

The following comment should be added to exclude your inline script from the LAB processing:
// LABjs exclusion

Help improve this page

Page status: Not set

You can: