One SDK for cross-platform publishing HTML5 games.
Supported platforms:
Plugins for game engines:
Join community: https://t.me/instant_games_bridge.
First you need to initialize the SDK:
<script src="https://cdn.jsdelivr.net/gh/mewtongames/[email protected]/dist/instant-games-bridge.js"></script>
<script>
instantGamesBridge
.initialize()
.then(() => {
// Initialized. You can use other methods.
})
.catch(error => {
// Error
})
</script>
// Get ID of current platform ('vk', 'yandex', 'mock')
instantGamesBridge.platform.id
let seconds = 30 // Default = 60
instantGamesBridge.advertisement.setMinimumDelayBetweenInterstitial(seconds)
// Optional parameter
let interstitialOptions = {
ignoreDelay: true // Default = false
}
// Request to show interstitial ads
instantGamesBridge
.advertisement
.showInterstitial(interstitialOptions)
.then(() => {
// Success
})
.catch(error => {
// Error
})
// Request to show rewarded video ads
instantGamesBridge
.advertisement
.showRewarded()
.then(() => {
// Success
})
.catch(error => {
// Error
})
instantGamesBridge.advertisement.on('interstitial_state_changed', state => console.log('Interstitial state:', state))
instantGamesBridge.advertisement.on('rewarded_state_changed', state => console.log('Rewarded state:', state))
// Get game data from storage
instantGamesBridge
.game
.getData(key)
.then(data => {
// Data has been received and you can work with them
// data = null if there is no data for this key
console.log('Data:', data)
})
.catch(error => {
// Error
})
// Set game data in storage
instantGamesBridge
.game
.setData(key, value)
.then(() => {
// Success
})
.catch(error => {
// Error
})