dojo/io/script (version 1.10)

Summary

TODOC

See the dojo/io/script reference documentation for more information.

Property Summary

Method Summary

  • _addDeadScript(ioArgs) sets up an entry in the deadScripts array.
  • _canAttach(ioArgs) provides an override of dojo.io.script._canAttach to check for the existence of a the args.frameDoc property.
  • _deferredCancel(dfd) canceller function for xhr._ioSetArgs call.
  • _deferredError(error,dfd) errHandler function for xhr._ioSetArgs call.
  • _deferredOk(dfd) okHandler function for xhr._ioSetArgs call.
  • _ioCheck(dfd) inflight check function to see if IO finished.
  • _jsonpCallback(json) generic handler for jsonp callback.
  • _makeScriptDeferred(args,cancel) sets up a Deferred object for an IO request.
  • _resHandle(dfd) inflight function to handle a completed response.
  • _validCheck(dfd) inflight check function to see if dfd is still valid.
  • attach(id,url,frameDocument) creates a new <script> tag pointing to the specified URL and adds it to the document.
  • get(args) sends a get request using a dynamically created script tag.
  • remove(id,frameDocument) removes the script element with the given id, from the given frameDocument.

Properties

_counter
Defined by: dojo/io/script
_deadScripts
Defined by: dojo/io/script

Methods

_addDeadScript(ioArgs)
Defined by dojo/io/script

sets up an entry in the deadScripts array.

Parameter Type Description
ioArgs Object
_canAttach(ioArgs)

provides an override of dojo.io.script._canAttach to check for the existence of a the args.frameDoc property. If it is there, and it is a string, not a document, then create the iframe with an ID of frameDoc, and use that for the calls. If frameDoc is a document, then dojox.io.scriptFrame should not get involved.

Parameter Type Description
ioArgs Object
_deferredCancel(dfd)
Defined by dojo/io/script

canceller function for xhr._ioSetArgs call.

Parameter Type Description
dfd Deferred
_deferredError(error,dfd)
Defined by dojo/io/script

errHandler function for xhr._ioSetArgs call.

Parameter Type Description
error Error
dfd Deferred
Returns:Error
_deferredOk(dfd)
Defined by dojo/io/script

okHandler function for xhr._ioSetArgs call.

Parameter Type Description
dfd Deferred
Returns:undefined
_ioCheck(dfd)
Defined by dojo/io/script

inflight check function to see if IO finished.

Parameter Type Description
dfd Deferred
Returns:boolean | undefined
_jsonpCallback(json)
Defined by dojo/io/script

generic handler for jsonp callback. A pointer to this function is used for all jsonp callbacks. NOTE: the "this" in this function will be the Deferred object that represents the script request.

Parameter Type Description
json JSON Object
_makeScriptDeferred(args,cancel)
Defined by dojo/io/script

sets up a Deferred object for an IO request.

Parameter Type Description
args Object
cancel Function
Optional
Returns:undefined
_resHandle(dfd)
Defined by dojo/io/script

inflight function to handle a completed response.

Parameter Type Description
dfd Deferred
_validCheck(dfd)
Defined by dojo/io/script

inflight check function to see if dfd is still valid.

Parameter Type Description
dfd Deferred
Returns:boolean
attach(id,url,frameDocument)
Defined by dojo/io/script

creates a new <script> tag pointing to the specified URL and adds it to the document.

Attaches the script element to the DOM. Use this method if you just want to attach a script to the DOM and do not care when or if it loads.

Parameter Type Description
id undefined
url undefined
frameDocument undefined
get(args)
Defined by dojo/io/script

sends a get request using a dynamically created script tag.

Parameter Type Description
args Object

An object with the following properties:

  • callbackParamName (String):

    Deprecated as of Dojo 1.4 in favor of "jsonp", but still supported for legacy code. See notes for jsonp property.

  • jsonp (String):

    The URL parameter name that indicates the JSONP callback string. For instance, when using Yahoo JSONP calls it is normally, jsonp: "callback". For AOL JSONP calls it is normally jsonp: "c".

  • checkString (String):

    A string of JavaScript that when evaluated like so: "typeof(" + checkString + ") != 'undefined'" being true means that the script fetched has been loaded. Do not use this if doing a JSONP type of call (use callbackParamName instead).

  • frameDoc (Document):

    The Document object for a child iframe. If this is passed in, the script will be attached to that document. This can be helpful in some comet long-polling scenarios with Firefox and Opera.

  • load:

    This function will be called on a successful HTTP response code.

  • error:

    This function will be called when the request fails due to a network or server error, the url is invalid, etc. It will also be called if the load or handle callback throws an exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications to continue to run even when a logic error happens in the callback, while making it easier to troubleshoot while in debug mode.

  • handle:

    This function will be called at the end of every request, whether or not an error occurs.

  • url (String):

    URL to server endpoint.

  • content (Object, optional):

    Contains properties with string values. These properties will be serialized as name1=value2 and passed in the request.

  • timeout (Integer, optional):

    Milliseconds to wait for the response. If this time passes, the then error callbacks are called.

  • form (DOMNode, optional):

    DOM node for a form. Used to extract the form values and send to the server.

  • preventCache (Boolean, optional):

    Default is false. If true, then a "dojo.preventCache" parameter is sent in the request with a value that changes with each request (timestamp). Useful only with GET-type requests.

  • handleAs (String, optional):

    Acceptable values depend on the type of IO transport (see specific IO calls for more information).

  • rawBody (String, optional):

    Sets the raw body for an HTTP request. If this is used, then the content property is ignored. This is mostly useful for HTTP methods that have a body to their requests, like PUT or POST. This property can be used instead of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.

  • ioPublish (Boolean, optional):

    Set this explicitly to false to prevent publishing of topics related to IO operations. Otherwise, if djConfig.ioPublish is set to true, topics will be published via dojo/topic.publish() for different phases of an IO operation. See dojo/main.__IoPublish for a list of topics that are published.

Returns:undefined
remove(id,frameDocument)
Defined by dojo/io/script

removes the script element with the given id, from the given frameDocument. If no frameDocument is passed, the current document is used.

Parameter Type Description
id undefined
frameDocument undefined
Error in the documentation? Can’t find what you are looking for? Let us know!