From 7c8b8a78f9029d8568a89e5f2a27c88a75b1daa2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Wed, 8 Jun 2016 07:52:44 +0200 Subject: [PATCH] Avoids javascript errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit But doesn't make AfbAngular functionnal. Change-Id: I643c81792fa757710327a8f66a79a1c8173ebe75 Signed-off-by: José Bollo --- test/AfbAngular.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/AfbAngular.js b/test/AfbAngular.js index 3db1ad59..71338cf9 100644 --- a/test/AfbAngular.js +++ b/test/AfbAngular.js @@ -35,16 +35,24 @@ this.ws = null; } + // prototype of functions linked to AfbContext object AfbContext.prototype = { + // call using websockets call: function(method, query) { return getws(this).call(method, query); }, + + // call using get get: function(method, query) { return $http.get(this.uhttp+method, mixtu(this, query)); }, - post: function(method, query) { return $http.post(this.uhttp+method, mixtu(this, query)); }, + + // call using post + post: function(method, query) { return $http.post(this.uhttp+method, mixtu(this, query)); } }; + // get the current websocket function getws(ctxt) { return ctxt.ws || (ctxt.ws = new AfbWebSocket(ctxt)); } + // inserts the current token in the answer function mixtu(ctxt, query) { return ("token" in query) ? query : angular.extend({token:ctxt.token},query); } @@ -131,6 +139,7 @@ +/* @@ -173,6 +182,8 @@ function call(method, request) { } +*/ + /* // Factory is a singleton and share its context within all instances. AfbClientModule.factory('AppCall', function ($http, AppConfig, $log) { -- 2.16.6