aboutsummaryrefslogtreecommitdiffstats
path: root/test/AfbAngular.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/AfbAngular.js')
-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) {