The Event class allows you to fire (broadcast) global events and subscribe to them. Here’s an example:

let data = true; // this could be any value
eventName = "Some Name";
Event.fire(eventName, data);

let SNCallback = function(data){
  log("callback: " + data);

function start(){
  Event.addListener("Some Name", SNCallback);
function onRemove(){
  Event.removeListener("Some Name", SNCallback);

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.

Tell us how we can improve this post?