net.jsloader

Classes

goog.net.jsloader.Error
A jsloader error.

Public Protected Private

Enumerations

goog.net.jsloader.ErrorCode :
Possible error codes for jsloader.
Constants:
LOAD_ERROR
No description.
TIMEOUT
No description.
VERIFY_ERROR
No description.
VERIFY_OBJECT_ALREADY_EXISTS
No description.
Code »

Global Functions

goog.net.jsloader.cancel_()
Cancels a given request.
code »
goog.net.jsloader.cleanup_(scriptNoderemoveScriptNodeopt_timeout)
Removes the script node and the timeout.
Arguments:
scriptNode : Node
The node to be cleaned up.
removeScriptNode : boolean
If true completely remove the script node.
opt_timeout : ?number=
The timeout handler to cleanup.
code »
goog.net.jsloader.getScriptParentElement_(doc) !Element
Gets the DOM element under which we should add new script elements. How? Take the first head element, and if not found take doc.documentElement, which always exists.
Arguments:
doc : !HTMLDocument
The relevant document.
Returns: !Element  The script parent element.
code »
goog.net.jsloader.load(uriopt_options) !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.
Arguments:
uri : string
The URI of the JavaScript.
opt_options : goog.net.jsloader.Options=
Optional parameters. See goog.net.jsloader.Options documentation for details.
Returns: !goog.async.Deferred  The deferred result, that may be used to add callbacks and/or cancel the transmission. The error callback will be called with a single goog.net.jsloader.Error parameter.
code »
goog.net.jsloader.loadAndVerify(uriverificationObjNameoptions) !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.
Arguments:
uri : string
The URI of the JavaScript.
verificationObjName : string
The name of the verification object that the loaded script should set.
options : goog.net.jsloader.Options
Optional parameters. See goog.net.jsloader.Options documentation for details.
Returns: !goog.async.Deferred  The deferred result, that may be used to add callbacks and/or cancel the transmission. The success callback will be called with a single parameter containing the value of the verification object. The error callback will be called with a single goog.net.jsloader.Error parameter.
code »
goog.net.jsloader.loadMany(urisopt_options)
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.load N times. If you need to load a large number of scripts on the same domain, you may want to use goog.module.ModuleLoader.
Arguments:
uris : Array.<string>
The URIs to load.
opt_options : goog.net.jsloader.Options=
Optional parameters. See goog.net.jsloader.options documentation for details.
code »

Global Properties

goog.net.jsloader.DEFAULT_TIMEOUT :
The default length of time, in milliseconds, we are prepared to wait for a load request to complete.
Code »
goog.net.jsloader.GLOBAL_VERIFY_OBJS_ :
The name of the property of goog.global under which the JavaScript verification object is stored by the loaded script.
Code »
goog.net.jsloader.Options :
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. Default it 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.
Code »
goog.net.jsloader.scriptsToLoad_ :
Scripts (URIs) waiting to be loaded.
Code »

Package net

Package Reference