1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-14 09:15:55 +00:00

build custom layer of Dojo to speed up loading of tt-rss (refs #293)

This commit is contained in:
Andrew Dolgov
2011-03-04 19:02:28 +03:00
parent cfad9259a6
commit a089699c89
144 changed files with 55627 additions and 13766 deletions

View File

@@ -5,28 +5,68 @@
*/
if(!dojo._hasResource["dojo.rpc.JsonpService"]){
dojo._hasResource["dojo.rpc.JsonpService"]=true;
if(!dojo._hasResource["dojo.rpc.JsonpService"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo.rpc.JsonpService"] = true;
dojo.provide("dojo.rpc.JsonpService");
dojo.require("dojo.rpc.RpcService");
dojo.require("dojo.io.script");
dojo.declare("dojo.rpc.JsonpService",dojo.rpc.RpcService,{constructor:function(_1,_2){
if(this.required){
if(_2){
dojo.mixin(this.required,_2);
}
dojo.forEach(this.required,function(_3){
if(_3==""||_3==undefined){
throw new Error("Required Service Argument not found: "+_3);
}
dojo.declare("dojo.rpc.JsonpService", dojo.rpc.RpcService, {
// summary:
// Generic JSONP service. Minimally extends RpcService to allow
// easy definition of nearly any JSONP style service. Example
// SMD files exist in dojox.data
constructor: function(args, requiredArgs){
if(this.required) {
if(requiredArgs){
dojo.mixin(this.required, requiredArgs);
}
dojo.forEach(this.required, function(req){
if(req=="" || req==undefined){
throw new Error("Required Service Argument not found: "+req);
}
});
}
},
strictArgChecks: false,
bind: function(method, parameters, deferredRequestHandler, url){
//summary:
// JSONP bind method. Takes remote method, parameters,
// deferred, and a url, calls createRequest to make a JSON-RPC
// envelope and passes that off with bind.
// method: string
// The name of the method we are calling
// parameters: array
// The parameters we are passing off to the method
// deferredRequestHandler: deferred
// The Deferred object for this particular request
var def = dojo.io.script.get({
url: url||this.serviceUrl,
callbackParamName: this.callbackParamName||"callback",
content: this.createRequest(parameters),
timeout: this.timeout,
handleAs: "json",
preventCache: true
});
def.addCallbacks(this.resultCallback(deferredRequestHandler), this.errorCallback(deferredRequestHandler));
},
createRequest: function(parameters){
// summary:
// create a JSONP req
// params: array
// The array of parameters for this request;
var params = (dojo.isArrayLike(parameters) && parameters.length==1) ?
parameters[0] : {};
dojo.mixin(params,this.required);
return params;
}
});
}
},strictArgChecks:false,bind:function(_4,_5,_6,_7){
var _8=dojo.io.script.get({url:_7||this.serviceUrl,callbackParamName:this.callbackParamName||"callback",content:this.createRequest(_5),timeout:this.timeout,handleAs:"json",preventCache:true});
_8.addCallbacks(this.resultCallback(_6),this.errorCallback(_6));
},createRequest:function(_9){
var _a=(dojo.isArrayLike(_9)&&_9.length==1)?_9[0]:{};
dojo.mixin(_a,this.required);
return _a;
}});
}