import RamperTelegram from 'ramper-telegram';
const sdkConfig = {
// gameId provided by Ramper, request before using the SDK
gameId: 'sdk_sample',
partner: 'coin98',
// partner app id provided by Ramper, request before using the SDK
appId: 'missing_app_id',
// callback functions for handling sign in success, sign in fail and sign message
onSignInSucess: (uProfile) => {
// handle user profile after sign in success
console.log('sign-in-success', uProfile);
},
onSignMessage: (msg) => {
// handle message after sign in success
console.log('sign-message-success', msg);
},
onSignInFail: (ev) => {
// handle sign in fail
console.error('sign-in-fail', ev);
}
}
// Initialize RamperTelegram
RamperTelegram.initializeAsync(sdkConfig)
.then(() => {
console.log('init ramper success')
})
.catch((reason => {
console.error('');
}))
Method 2: Using CDN in HTML
<!-- Double check the version of the SDK before using it -->
<script src="https://game-sdk.static.cyborg.game/rampertelegram.umd.production.min.js"></script>
<script>
RamperTelegram.initializeAsync({
// gameId provided by Ramper, request before using the SDK
gameId: 'sdk_sample',
partner: 'coin98',
// partner app id provided by Ramper, request before using the SDK
appId: 'missing_app_id',
// callback functions for handling sign in success, sign in fail and sign message
onSignInSucess: (uProfile) => {
// handle user profile after sign in success
console.log('sign-in-success', uProfile);
},
onSignMessage: (msg) => {
// handle message after sign in success
console.log('sign-message-success', msg);
},
onSignInFail: (ev) => {
// handle sign in fail
console.error('sign-in-fail', ev);
}
}).then(() => {
console.log('init ramper success')
}).catch((reason => {
console.error('');
}))
</script>
Functions
getSDKVersion
Description
The string representation of this SDK version.
getSDKVersion(): string
Returns
string Returns string The SDK version.
Example
var sdkVersion = RamperTelegram.getSDKVersion(); // '1.0'
hideIframe
Description
Hide iframe
hideIframe(): void
Returns
void
Example
RamperTelegram.hideIframe();
initializeAsync
Description
Initializes the SDK library. This should be called before any other SDK functions. Login request be fired on this.