X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=test%2FAfbAngular.js;h=71338cf9c6390f865fcb40a4eb68414d5fd1753e;hb=7c8b8a78f9029d8568a89e5f2a27c88a75b1daa2;hp=3db1ad591eb602ea6880a503d36fba614b6c8869;hpb=bf9d05d3ba3c482a75cfa6aedf661f6e51728e3e;p=src%2Fapp-framework-binder.git 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) {