Reacting to Events
The Game Client MUST react to the following events coming from Kalamba SDK:
Balance
When received, the Game Client MUST update in-game balance.
sdk.on('balance', payload => {
game.setBalance(payload)
})
Bet
When received, the Game Client MUST update in-game bet.
sdk.on('bet', payload => {
game.setBet(payload)
})
Close
When received, the Game Client MAY use this event to do some last minute housekeeping. The game will be closed imminently, so the Game Client SHOULD use the Beacon API if it plans to make any network requests.
sdk.on('close', () => {
game.close()
})
Freeze
When received, the Game Client MUST pause the game and prevent further gameplay and interactions with the user interface. The Game Client MUST stop autoplay if it is engaged. The Game Client MAY finish the animations that were already playing when the event was received, but it is RECOMMENDED that all animations are paused as well.
sdk.on('freeze', () => {
game.freeze()
})
Game Help
When received, the Game Client MUST toggle game help.
sdk.on('help', payload => {
game.toggleHelp(show)
})
Game History
When received, the Game Client MUST toggle game history.
sdk.on('history', payload => {
game.toggleHistory(show)
})
Game Paytable
When received, the Game Client MUST toggle game paytable.
sdk.on('paytable', payload => {
game.togglePaytable(show)
})
Play
When received, the Game Client MUST make play request.
sdk.on('play', payload => {
game.play(payload)
})
Resume
When received, the Game Client MUST resume autoplay if it was previously paused in response to suspend
event.
When received, the Game Client MAY ignore the event if resuming autoplay is not possible.
sdk.on('resume', payload => {
game.resumeAutoplay()
})
Settings
When received, the Game Client MUST update in-game settings. The payload MUST include only settings that have been changed.
sdk.on('settings', payload => {
game.updateSettings(payload)
})
Suspend
When received, the Game Client MUST pause autoplay if it is engaged. When received, the Game Client MAY stop autoplay instead if pausing autoplay is not possible.
sdk.on('suspend', payload => {
game.pauseAutoplay()
})
Unfreeze
When received, the Game Client MUST unpause the game and allow further gameplay and interactions with the user interface.
The Game Client MUST resume any animations that were paused by the freeze
event.
sdk.on('unfreeze', payload => {
game.unfreeze()
})
Legal Bets
When received, the Game Client MUST update legal bets available in game.
sdk.on('legalBets', payload => {
game.setLegalBets(payload)
})