summaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorHumberto Alfonso Díaz <humberto.alfonso@asvito.es>2019-06-21 11:00:42 +0200
committerLorenzo Tilve <ltilve@igalia.com>2020-02-04 19:12:47 +0100
commitd15f8cb06f8d45e9bdaf28cf861f2f14d23ef968 (patch)
tree68d22601d2d71736b53a95652d40bbaef019ae4e /src/js
parent6f85d8e888c85b62ae1ab1dd57c26257da48b173 (diff)
FUNCT Basic support to launch apps
Diffstat (limited to 'src/js')
-rw-r--r--src/js/app.js31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/js/app.js b/src/js/app.js
index fccf04e..9c65e4f 100644
--- a/src/js/app.js
+++ b/src/js/app.js
@@ -46,14 +46,35 @@ function load_application_list() {
});
}
-function init() {
+export function launch(app) {
+ var appId = app.getAttribute('app-id');
+ var ws = new afb.ws(function() {
+ var api_verb = "afm-main/start";
+ var request = {id: appId};
+ ws.call(api_verb, request).then(
+ function(obj) {
+ log("success: " + obj.response);
+ },
+ function(obj) {
+ //TODO Manage errors
+ log("failure");
+ }
+ );
+ },
+ function() {
+ //TODO Manage errors
+ log("ws aborted");
+ });
+}
+
+export function init() {
template = document.getElementById('item-template').innerHTML;
Mustache.parse(template);
+
+ // host: "raspberrypi3.local:31022",
afb = new AFB({
- host: "raspberrypi3.local:31022",
+ host: host+":"+port,
token: token
});
load_application_list();
-}
-
-document.addEventListener('DOMContentLoaded', init); \ No newline at end of file
+} \ No newline at end of file