Configure JSONP proxy with a strategy object
Reported by lindsay.kay (at xeolabs) | May 30th, 2010 @ 08:14 AM | in V0.7.6
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];
}
});
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
SceneJS provides easy access to WebGL through a simple and declarative JavaScript API. The SceneJS API is functional, which enables its scene definitions to be really compact and expressive, while hooking into other JavaScript code just that little bit more smoothly.