Frontend API is a two-way communication between Tom Horn Gaming and the game embedded inside the iframe. Implementation uses cross-origin communication between “window” objects via “window.postMessage” function and “message” event. As the game is embedded in the iframe, it sends a message to the parent window.
Sending message example:
window.parent.postMessage(message, "*");
To receive messages, subscribe to “message” event:
window.addEventListener("message", function(event){
//event.data is a message that's been sent from the EM window.
console.log(event.data);
});
Message data is a JavaScript object in the following format:
{
"name": "messageName",
“sender”:”game”, “data”:
“any data object”
}
The object parameters Name and Sender are common for all message types. The use of the parameter Data varies depending on the message.
Parameter |
Type |
Description |
Name |
String |
Message name |
Sender |
String |
The value indicating whether the message is sent from Tom Horn to a game, or vice versa. If the message is sent from Tom Horn to the game, the value is set to emwindow. If the message is sent from the game to Tom Horn, the value is game |
Stop Auto Spins
A message is sent from Tom Horn to the game to stop auto spins. This kind of message is usually sent by Tom Horn when a modal window is about to appear, and the user is not able to interact with the game. Its primary purpose is to offer a unified approach to displaying any license-specific functionality within the iframe, for example, MGA and UKCG reality checks.
Example:
{
"name": "stopAutospins",
"sender": "emwindow"
}
Comments
0 comments
Article is closed for comments.