goog.net.jsloader
Functions
safeLoad( trustedUri, opt_options ) → goog.async.Deferred
goog.async.Deferred
Loads and evaluates a JavaScript file. When the script loads, a user callback is called. It is the client's responsibility to verify that the script ran successfully.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
safeLoadAndVerify( trustedUri, verificationObjName, options ) → goog.async.Deferred
goog.async.Deferred
Loads a JavaScript file and verifies it was evaluated successfully, using a verification object. The verification object is set by the loaded JavaScript at the end of the script. We verify this object was set and return its value in the success callback. If the object is not defined we trigger an error callback.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
safeLoadMany( trustedUris, opt_options ) → goog.async.Deferred
goog.async.Deferred
Loads and evaluates the JavaScript files at the specified URIs, guaranteeing the order of script loads.
Because we have to load the scripts in serial (load script 1, exec script 1, load script 2, exec script 2, and so on), this will be slower than doing the network fetches in parallel.
If you need to load a large number of scripts but dependency order doesn't matter, you should just call goog.net.jsloader.safeLoad N times.
If you need to load a large number of scripts on the same domain, you may want to use goog.module.ModuleLoader.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Properties
DEFAULT_TIMEOUT → number
number
The default length of time, in milliseconds, we are prepared to wait for a load request to complete.
Optional parameters for goog.net.jsloader.send. timeout: The length of time, in milliseconds, we are prepared to wait for a load request to complete, or 0 or negative for no timeout. Default is 5 seconds. document: The HTML document under which to load the JavaScript. Default is the current document. cleanupWhenDone: If true clean up the script tag after script completes to load. This is important if you just want to read data from the JavaScript and then throw it away. Default is false. attributes: Additional attributes to set on the script tag.