aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-06-08 07:52:44 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-06-08 11:48:35 +0200
commit7c8b8a78f9029d8568a89e5f2a27c88a75b1daa2 (patch)
tree14a2f2ad38d57748ad163135780cfdcef9f39c70 /test
parentbf9d05d3ba3c482a75cfa6aedf661f6e51728e3e (diff)
Avoids javascript errors
But doesn't make AfbAngular functionnal. Change-Id: I643c81792fa757710327a8f66a79a1c8173ebe75 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'test')
-rw-r--r--test/AfbAngular.js13
1 files changed, 12 insertions, 1 deletions
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) {