From 89d4a5c5df14f085387032830a87afd73296971c Mon Sep 17 00:00:00 2001 From: Pawel Kaczmarek
Since Tizen 2.4 Web applications can broadcast own events. Events can be broadcasted to all listeners which are listening for these events.
+Web applications can also broadcast trusted events only for trusted listeners with the same certificate as the sender's application.
+The following code example demonstrates how to broadcast an event:
++var app = tizen.application.getCurrentApplication(); +var appEvent = {name: "custom_user_event"}; +var data = {foo: "bar"}; + +app.broadcastEvent(appEvent, data); + +// for trusted events +app.broadcastTrustedEvent(appEvent, data); ++ +
If you want to receive event data from other application addEventListener() with sender's application ID and event name should be invoked.
++var watchId = app.addEventListener({appId: "a234567890.TestWidget", name: "custom_user_event"}, function(event, data) { + console.log("Data: " + JSON.stringify(data)); + // do something +}); ++ +
If you want to stop receiving event data from other application removeEventListener() with proper watchId should be invoked.
++app.removeEventListener(watchId); +@@ -500,4 +527,4 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga