Callback function that activates when a message is sent from the widget to the App.
Parameters
Example
Create a function to close the widget screen when x is pressed.
// Activates function when a player entersApp.onJoinPlayer.Add(function (player) {player.tag = { widget:null, };player.tag.widget =player.showWidget("sample.html.html","top",600,500);player.tag.widget.onMessage.Add(function (player, msg) {// Closes the widget when the 'type: close' message is sent from the widget to the App if (msg.type =="close") {player.showCenterLabel("Widget has been closed.");player.tag.widget.destroy();player.tag.widget =null; } });});
sample.html: Button and script section
<ionclick="closeWidget()"class="fa-solid fa-xmark"></i><scripttype="text/javascript"> // Calls the function when x button is pressed function closeWidget() {// Sends message to App window.parent.postMessage( { type:"close", },"*" ); }</script>