From c6d119aa768bc6123f6b0077c923a29509b62653 Mon Sep 17 00:00:00 2001 From: Frederic PAUT Date: Tue, 16 Apr 2013 17:31:54 +0200 Subject: [PATCH] request : Bug fix --- cloudeebus/cloudeebus.js | 17 ++++------------- doc/sample/cloudeebus.html | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/cloudeebus/cloudeebus.js b/cloudeebus/cloudeebus.js index 1521426..a0462de 100644 --- a/cloudeebus/cloudeebus.js +++ b/cloudeebus/cloudeebus.js @@ -519,27 +519,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) { diff --git a/doc/sample/cloudeebus.html b/doc/sample/cloudeebus.html index c177859..b03391c 100644 --- a/doc/sample/cloudeebus.html +++ b/doc/sample/cloudeebus.html @@ -46,7 +46,7 @@ function gotNotifProxy(proxy) { } function gotBusProxy(proxy) { - proxy.ListNames(logCB, errorCB); + proxy.ListNames().then(logCB, errorCB); } function connectSuccess() { -- 2.7.4