Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is LABjs?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

The main content of this article is to explain "what is LABjs". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what LABjs is.

LABjs is a dynamic script loader designed to replace the use of ugly, non-performance tags with flexible and performance-optimized API. LABjs is characterized by the ability to load all JavaScript files in parallel at the speed allowed by the browser, but if there are dependencies between the files, you can choose to ensure the correct order of execution.

LABjs method loading

$LAB.setGlobalDefaults ()

The parameter values are:

AlwaysPreserveOrder A Boolean value (default is false) that controls whether an implicit empty wait () call assumes that after each script is loaded, basically all scripts are executed in serial order in the chain force (load in parallel, which is not allowed by default).

UseLocalXHR A Boolean value (default is true) preloads the script with ajaxXHR

AllowDuplicates

A Boolean value (default is false) controls whether LABjs checks its internal script URL cache to prevent the script URI from being (accidentally, probably) loaded once. By default, LABjs does not make any repeated requests for the URL of the same script.

The basic path of the BasePath local script

CacheBust A Boolean value (default is false) adds a random number parameter to prevent the URL of each script from your requested URL cache access

Debug Boolean value, which is used by the web console to record the loading / processing logic of each step of $LAB. This property takes effect only after the LABjs source code or LAB-debug.min.js file is introduced.

$LAB.setOptions ()

Setting one or more options only affects the current $LAB execution chain, and this method must be the first execution method of the $LAB chain. The parameter is the same as setGlobalDefaults (). The format is: $LAB.setOptions ({.}) .script (...).

LABjs load script

$LAB.script () load script

Pass parameters:

String a relative or absolute script address

The object object contains the following properties:

Location of the srcscript file

Type specifies the type ("text/javascript", "text/vbscript")

Charset specifies the character encoding

Array array

Function function if a function is found as one of the parameters, the function will be executed immediately and must return a value directly. The return value must be another allowed type (string, object, or array). If the result of a function call is in any return value ("undefined") or if the value is "falsy" (false, null, etc.), it will be considered to have no script loaded

At this point, I believe you have a deeper understanding of "what LABjs is", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report