Connection to the game using MessageChannel
- Source:
Methods
(inner) call(method, dataopt)
Call method in the open game
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
method |
String | name of the method to call |
|
data |
Object |
<optional> |
optional data for the method called, if any |
- Source:
Example
// reload the game
api.call('reload');
(inner) on(event, callback)
Add listener for event from the started game
Parameters:
Name | Type | Description |
---|---|---|
event |
String | name of the event |
callback |
function | callback for the event, see specific event documentation for any parameters |
- Source:
Example
api.on('deposit', function openDeposit () {
showDeposit().then(function() {
// ask the game to refresh balance from server
api.call('refresh');
});
});
(inner) trigger(event, dataopt)
Triggers a named event
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
event |
String | name of the event |
|
data |
Object |
<optional> |
optional data for the event, if any |
- Source: