This method sends a message event to be delivered to a box. The box must implement
an on:message handler to receive. NOTE: The payload dictionary is available by
accessing the paramsDictionary property on the event.
function onSample()
{
var myBox = scene.getBoxById("myBox");
if (myBox)
{
var dict = shell.serviceManager.basics.dictionary;
if (dict)
{
dict.setValueForKey("sampleItem", "item");
myBox.sendMessage("myMessage", dict);
}
}
}
// when box receives a message.
function onMessage()
{
var eventObj = shell.currentEvent;
if (eventObj)
{
// Get the payload.
var dictionary = eventObj.paramsDictionary;
if (dictionary)
{
// Do something.
}
}
}