datasource-scriptnode-debug.js revision bab7b684072c4810ad2fab84014166f8fca4893d
1N/AYUI.
add(
'datasource-scriptnode',
function(Y) {
1N/A * The DataSource utility provides a common configurable interface for widgets to 1N/A * access a variety of data, from JavaScript arrays to online database servers. 1N/A * @module datasource 1N/A * Dynamic script node subclass for the YUI DataSource utility. 1N/A * @class DataSource.ScriptNode 1N/A * @extends DataSource.Local 1N/A ///////////////////////////////////////////////////////////////////////////// 1N/A // DataSource.ScriptNode static properties 1N/A ///////////////////////////////////////////////////////////////////////////// 1N/A * @value "dataSourceScriptNode" 1N/A ///////////////////////////////////////////////////////////////////////////// 1N/A // DataSource.ScriptNode Attributes 1N/A ///////////////////////////////////////////////////////////////////////////// 1N/A * Pointer to Get Utility. 1N/A * <!--<dt>queueRequests</dt> 1N/A * <dd>If a request is already in progress, wait until response is returned before sending the next request.</dd> 1N/A * <dt>cancelStaleRequests</dt> 1N/A * <dd>If a request is already in progress, cancel it before sending the next request.</dd>--> 1N/A * <dt>ignoreStaleResponses</dt> 1N/A * <dd>Send all requests, but handle only the response for the most recently sent request.</dd> 1N/A * <dd>Send all requests and handle all responses.</dd> 1N/A * @attribute asyncMode 1N/A * @default "allowAll" 1N/A * Callback string parameter name sent to the remote script. By default, 1N/A * requests are sent to 1N/A * <URI>?<scriptCallbackParam>=callbackFunction 1N/A * @attribute scriptCallbackParam 1N/A * @default "callback" 1N/A * Accepts the DataSource instance and a callback ID, and returns a callback 1N/A * param/value string that gets appended to the script URI. Implementers 1N/A * can customize this string to match their server's query syntax. 1N/A * @attribute generateRequestCallback 1N/A return "&" +
self.
get(
"scriptCallbackParam") +
"=YUI.Env.DataSource.callbacks["+
id+
"]" ;
1N/A * Global array of callback functions, one for each request sent. 1N/A * @property callbacks 1N/A * Unique ID to track requests. 1N/A * Passes query string to Get Utility. Fires <code>response</code> event when 1N/A * response is received asynchronously. 1N/A * @method _defRequestFn 1N/A * @param e {Event.Facade} Event Facade with the following properties: 1N/A * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> 1N/A * <dt>request (Object)</dt> <dd>The request.</dd> 1N/A * <dt>callback (Object)</dt> <dd>The callback object with the following properties: 1N/A * <dt>success (Function)</dt> <dd>Success handler.</dd> 1N/A * <dt>failure (Function)</dt> <dd>Failure handler.</dd> 1N/A * <dt>cfg (Object)</dt> <dd>Configuration object.</dd> 1N/A // Dynamically add handler function with a closure to the callback stack 1N/A if((
self.
get(
"asyncMode") !==
"ignoreStaleResponses")||
1N/A Y.
log(
"DataSource ignored stale response for id " + e.
tId +
"(" + e.
request +
")",
"info",
"datasource-scriptnode");
1N/A // We are now creating a request 1N/A //uri = this.doBeforeGetScriptNode(sUri); 1N/A Y.
log(
"DataSource is querying URL " +
uri,
"info",
"datasource-scriptnode");
1N/A // Works in Firefox only.... 1N/A},
'@VERSION@' ,{
requires:[
'datasource-local',
'get']});