summaryrefslogtreecommitdiff
path: root/lib/dojo/rpc/RpcService.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dojo/rpc/RpcService.js')
-rw-r--r--lib/dojo/rpc/RpcService.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/dojo/rpc/RpcService.js b/lib/dojo/rpc/RpcService.js
index e504818be..6b1d9dc06 100644
--- a/lib/dojo/rpc/RpcService.js
+++ b/lib/dojo/rpc/RpcService.js
@@ -1,8 +1,8 @@
/*
- Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
-define("dojo/rpc/RpcService",["../main","../_base/url"],function(_1){_1.declare("dojo.rpc.RpcService",null,{constructor:function(_2){if(_2){if((_1.isString(_2))||(_2 instanceof _1._Url)){if(_2 instanceof _1._Url){var _3=_2+"";}else{_3=_2;}var _4=_1.xhrGet({url:_3,handleAs:"json-comment-optional",sync:true});_4.addCallback(this,"processSmd");_4.addErrback(function(){throw new Error("Unable to load SMD from "+_2);});}else{if(_2.smdStr){this.processSmd(_1.eval("("+_2.smdStr+")"));}else{if(_2.serviceUrl){this.serviceUrl=_2.serviceUrl;}this.timeout=_2.timeout||3000;if("strictArgChecks" in _2){this.strictArgChecks=_2.strictArgChecks;}this.processSmd(_2);}}}},strictArgChecks:true,serviceUrl:"",parseResults:function(_5){return _5;},errorCallback:function(_6){return function(_7){_6.errback(_7.message);};},resultCallback:function(_8){return _1.hitch(this,function(_9){if(_9.error!=null){var _a;if(typeof _9.error=="object"){_a=new Error(_9.error.message);_a.code=_9.error.code;_a.error=_9.error.error;}else{_a=new Error(_9.error);}_a.id=_9.id;_a.errorObject=_9;_8.errback(_a);}else{_8.callback(this.parseResults(_9));}});},generateMethod:function(_b,_c,_d){return _1.hitch(this,function(){var _e=new _1.Deferred();if((this.strictArgChecks)&&(_c!=null)&&(arguments.length!=_c.length)){throw new Error("Invalid number of parameters for remote method.");}else{this.bind(_b,_1._toArray(arguments),_e,_d);}return _e;});},processSmd:function(_f){if(_f.methods){_1.forEach(_f.methods,function(m){if(m&&m.name){this[m.name]=this.generateMethod(m.name,m.parameters,m.url||m.serviceUrl||m.serviceURL);if(!_1.isFunction(this[m.name])){throw new Error("RpcService: Failed to create"+m.name+"()");}}},this);}this.serviceUrl=_f.serviceUrl||_f.serviceURL;this.required=_f.required;this.smd=_f;}});return _1.rpc.RpcService;}); \ No newline at end of file
+define("dojo/rpc/RpcService",["../_base/array","../_base/declare","../_base/Deferred","../_base/kernel","../_base/lang","../_base/url","../_base/xhr"],function(_1,_2,_3,_4,_5,_6,_7){return _2("dojo.rpc.RpcService",null,{constructor:function(_8){if(_8){if((_5.isString(_8))||(_8 instanceof _6)){if(_8 instanceof _6){var _9=_8+"";}else{_9=_8;}var _a=_7.get({url:_9,handleAs:"json-comment-optional",sync:true});_a.addCallback(this,"processSmd");_a.addErrback(function(){throw new Error("Unable to load SMD from "+_8);});}else{if(_8.smdStr){this.processSmd(_4.eval("("+_8.smdStr+")"));}else{if(_8.serviceUrl){this.serviceUrl=_8.serviceUrl;}this.timeout=_8.timeout||3000;if("strictArgChecks" in _8){this.strictArgChecks=_8.strictArgChecks;}this.processSmd(_8);}}}},strictArgChecks:true,serviceUrl:"",parseResults:function(_b){return _b;},errorCallback:function(_c){return function(_d){_c.errback(_d.message);};},resultCallback:function(_e){return _5.hitch(this,function(_f){if(_f.error!=null){var err;if(typeof _f.error=="object"){err=new Error(_f.error.message);err.code=_f.error.code;err.error=_f.error.error;}else{err=new Error(_f.error);}err.id=_f.id;err.errorObject=_f;_e.errback(err);}else{_e.callback(this.parseResults(_f));}});},generateMethod:function(_10,_11,url){return _5.hitch(this,function(){var _12=new _3();if((this.strictArgChecks)&&(_11!=null)&&(arguments.length!=_11.length)){throw new Error("Invalid number of parameters for remote method.");}else{this.bind(_10,_5._toArray(arguments),_12,url);}return _12;});},processSmd:function(_13){if(_13.methods){_1.forEach(_13.methods,function(m){if(m&&m.name){this[m.name]=this.generateMethod(m.name,m.parameters,m.url||m.serviceUrl||m.serviceURL);if(!_5.isFunction(this[m.name])){throw new Error("RpcService: Failed to create"+m.name+"()");}}},this);}this.serviceUrl=_13.serviceUrl||_13.serviceURL;this.required=_13.required;this.smd=_13;}});}); \ No newline at end of file