Namespace gadgets.io
Provides remote content retrieval functions.
Defined in: gadgets.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
| <inner> |
Holds configuration-related data such as proxy urls.
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
gadgets.io.encodeValues(fields, opt_noEscaping)
Converts an input object into a URL-encoded data string.
|
| <static> |
gadgets.io.getProxyUrl(url, opt_params)
Gets the proxy version of the passed-in URL.
|
| <inner> |
hadError(xobj, callback)
Checks the xobj for errors, may call the callback with an error response
if the error is fatal.
|
| <static> |
gadgets.io.makeRequest(url, callback, Additional)
makeRequest implementation using proxy
Fetches content from the provided URL and feeds that content into the callback function
|
| <inner> |
makeXhr()
Internal facility to create an xhr request.
|
| <inner> |
makeXhrRequest(realUrl, proxyUrl, callback, postData, params, processResponseFunction, processResponseFunction, opt_contentType)
Sends an XHR post or get request
|
| <inner> |
processNonProxiedResponse(url, callback, params, xobj)
Handles non-proxied XHR callback processing.
|
| <inner> |
processResponse(url, callback, params, xobj)
Handles XHR callback processing.
|
| <inner> |
respondWithPreload(postData, params, callback)
Satisfy a request with data that is prefetched as per the gadget Preload
directive.
|
| <inner> |
transformResponseData(params, data)
|
Field Detail
<inner>
config
Holds configuration-related data such as proxy urls.
Method Detail
<static>
{String}
gadgets.io.encodeValues(fields, opt_noEscaping)
Converts an input object into a URL-encoded data string.
(key=value&...)
- Parameters:
- {Object} fields
- The post fields you wish to encode
- {Boolean} opt_noEscaping
- An optional parameter specifying whether to turn off escaping of the parameters. Defaults to false.
- Returns:
- {String} The processed post data in www-form-urlencoded format.
<static>
{String}
gadgets.io.getProxyUrl(url, opt_params)
Gets the proxy version of the passed-in URL.
- Parameters:
- {String} url
- The URL to get the proxy URL for
- {Object} opt_params
- Optional Parameter Object. The following properties are supported: .REFRESH_INTERVAL The number of seconds that this content should be cached. Defaults to 3600.
- Returns:
- {String} The proxied version of the URL
<inner>
hadError(xobj, callback)
Checks the xobj for errors, may call the callback with an error response
if the error is fatal.
- Parameters:
- {Object} xobj
- The XHR object to check
- {Function} callback
- The callback to call if the error is fatal
- Returns:
- true if the xobj is not ready to be processed
<static>
gadgets.io.makeRequest(url, callback, Additional)
makeRequest implementation using proxy
Fetches content from the provided URL and feeds that content into the callback function
- Parameters:
- {String} url
- The URL where content is located
- {Function} callback
- The function to call with the data returned from url
- {gadgets.io.RequestParameters} Additional
- parameters to pass to the request
<inner>
makeXhr()
Internal facility to create an xhr request.
<inner>
makeXhrRequest(realUrl, proxyUrl, callback, postData, params, processResponseFunction, processResponseFunction, opt_contentType)
Sends an XHR post or get request
- Parameters:
- realUrl
- The url to fetch data from that was requested by the gadget
- proxyUrl
- The url to proxy through
- callback
- The function to call once the data is fetched
- postData
- The data to post to the proxyUrl
- params
- The params to use when processing the response
- processResponseFunction
- The function that should process the response from the sever before calling the callback
- processResponseFunction
- opt_contentType
<inner>
processNonProxiedResponse(url, callback, params, xobj)
Handles non-proxied XHR callback processing.
- Parameters:
- {String} url
- {Function} callback
- {Object} params
- {Object} xobj
<inner>
processResponse(url, callback, params, xobj)
Handles XHR callback processing.
- Parameters:
- {String} url
- {Function} callback
- {Object} params
- {Object} xobj
<inner>
respondWithPreload(postData, params, callback)
Satisfy a request with data that is prefetched as per the gadget Preload
directive. The preloader will only satisfy a request for a specific piece
of content once.
- Parameters:
- postData
- The definition of the request to be executed by the proxy
- params
- The params to use when processing the response
- callback
- The function to call once the data is fetched
- Returns:
- true if the request can be satisfied by the preloaded content false otherwise
<inner>
transformResponseData(params, data)
- Parameters:
- params
- data