request : Bug fix
authorFrederic PAUT <frederic.paut@linux.intel.com>
Tue, 16 Apr 2013 15:31:54 +0000 (17:31 +0200)
committerFrederic PAUT <frederic.paut@linux.intel.com>
Tue, 16 Apr 2013 15:31:54 +0000 (17:31 +0200)
cloudeebus/cloudeebus.js
doc/sample/cloudeebus.html

index 2363a47..7a03c8b 100644 (file)
@@ -253,27 +253,18 @@ cloudeebus.ProxyObject.prototype._addMethod = function(ifName, method, nArgs) {
        var self = this;
        
        self[method] = function() {
-               if (arguments.length < nArgs || arguments.length > nArgs + 2)
-                       throw "Error: method " + method + " takes " + nArgs + " parameters, got " + arguments.length + ".";
                var args = [];
-               var successCB = null;
-               var errorCB = null;
                for (var i=0; i < nArgs; i++ )
                        args.push(arguments[i]);
-               if (arguments.length > nArgs)
-                       successCB = arguments[nArgs];
-               if (arguments.length > nArgs + 1)
-                       errorCB = arguments[nArgs + 1];
-               self.callMethod(ifName, method, args).then(successCB, errorCB);
-       };
-       
+               return self.callMethod(ifName, method, args);
+       };      
 };
 
 cloudeebus.ProxyObject.prototype.callMethod = function(ifName, method, args) {
        
        var self = this;
-       var request = new cloudeebus.Request(this, successCB, errorCB);
-
+       var request = new cloudeebus.Request(this);
+       
        function callMethodSuccessCB(str) {
                request.result = eval(str);
                if (request.onsuccess) {
index c177859..b03391c 100644 (file)
@@ -46,7 +46,7 @@ function gotNotifProxy(proxy) {
 }
 
 function gotBusProxy(proxy) {
-  proxy.ListNames(logCB, errorCB);
+  proxy.ListNames().then(logCB, errorCB);
 }
 
 function connectSuccess() {