Extend SceneJS JSONP proxy configuration to set both how the
request URL is generated and how the string data to be parsed is
extracted from the response.
A new SceneJS.setJSONPProxy method configures SceneJS with a
strategy to allow it to use a particular Web service to proxy
cross-domain requests by SceneJS.Instance nodes when their URIs are
not in the local domain. As shown in the example below, the
strategy must implement two methods, one to create the request URL
and another to extract a string of data from the response.
Example strategy- specifying a JSONP handler for the
Yahoo! Query Language (YQL) API:
SceneJS.setJSONPStrategy({
request : function(url, format, callback) {
return "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20" + format + "%20where%20url='"
+ url + "'&format=" + format + "&callback=" + callback;
},
response : function(data) {
return data.results[0];
}
});