AFB.js: pass event name 34/23534/1
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 19 Dec 2019 13:30:58 +0000 (14:30 +0100)
committerJose Bollo <jose.bollo@iot.bzh>
Fri, 3 Jan 2020 15:53:38 +0000 (16:53 +0100)
The event name is given at second position,
preserving existing code and making its
use optionnal.

Bug-AGL: SPEC-3069

Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Change-Id: Ieeed1762977b990c139d56c4d78e2b539d6927c6

test/monitoring/AFB.js

index 953fe96..227b1a9 100644 (file)
@@ -125,16 +125,16 @@ var AFB_websocket;
        function fire(awaitens, name, data) {
                var a = awaitens[name];
                if (a)
-                       a.forEach(function(handler){handler(data);});
+                       a.forEach(function(handler){handler(data, name);});
                var i = name.indexOf("/");
                if (i >= 0) {
                        a = awaitens[name.substring(0,i)];
                        if (a)
-                               a.forEach(function(handler){handler(data);});
+                               a.forEach(function(handler){handler(data, name);});
                }
                a = awaitens["*"];
                if (a)
-                       a.forEach(function(handler){handler(data);});
+                       a.forEach(function(handler){handler(data, name);});
        }
 
        function reply(pendings, id, ans, offset) {