Peruttu

Javascript Async Script Loader

A jQuery function is needed to load other javascript files in parallel. After the script is loaded a provided callback function needs to be called.

Requirements:

* This function must wait for all scripts to be loaded before calling the callback function.

* It's possible to have more than one callback function for the same dependencies or other dependencies. They must be queued to wait for its dependent scripts to load as soon as its required scripts are loaded.

* Scripts should not be loaded more than once. If more than one script requires the same script, only one load should be done.

* A script may be required by one script which is required by another script. [url removed, login to view] and [url removed, login to view] (this function) will always be loaded with the regular method (script tag). See bellow:

[url removed, login to view]

/ | \

/ | \

[url removed, login to view] | [url removed, login to view]

|

|

-------------

| | |

[url removed, login to view] [url removed, login to view] [url removed, login to view]

| \ |

/ \ ---\

[url removed, login to view] [url removed, login to view] [url removed, login to view]

| |

[url removed, login to view] ----------/

Calling method (jquery plugin):

$.requireOnce(array of scripts, callback, caller script [unless you find a way to avoid this parameter], charset);

Example:

$.requireOnce(["/js/test1.js","/js/test2.js"],do_something(),"/js/somescript.js","ISO-8859-1");

The reason we need to load scripts in parallel is explained here

[url removed, login to view]

Taidot: Javascript

Näytä lisää: javascript async, javascript loader, async script, async loader, javascript wait callback, async javascript loader, script async, async javascript, script async callback, async load script, callback javascript async, script load, javascript script loader, javascript async loader, script loaded, find ppt, find javascript, load javascript parallel, asynchron script loading, js script, jquery script, jquery javascript, iso, async, jquery callback html

Tietoa työnantajasta:
( 82 arvostelua ) karachi, Pakistan

Projektin tunnus: #405161