string
AuthToken
AuthBanInfo
string
string
any
string
string
string
string
boolean
boolean
boolean
guest, google, facebook, twitter, line, payco, and so on.
AuthToken has several information such as token, member and ban information.
Analytics classes
This method sends level information to the server. This method is used to transfer level information to the server if the game is successful.
Since Added 2.0.0.
Level information of the user received from the game server after login.
This method sends level-up information to the server. This method is used to send level-up information to the server when level up in game.
Since Added 2.0.0.
User level up information
Launching classes
This method returns Gamebase launching information.
Since Added 2.0.0.
This method returns Gamebase launching status.
Since Added 2.0.0.
Network classes
This method returns network connecting status using browser API navigator.onLine.
Since Added 2.0.0.
boolean
Charge your points
Since Added 2.8.0.
Request a item list which is purchasable. This list has items which are registered in both Market(AppStore) and ToastCloud IAP Console.
Since Added 2.8.0.
Call following API of an item to purchase by using itemId to send a purchase request. When a game user cancels purchasing, the PURCHASE_USER_CANCELED error will be returned.
Since Added 2.8.0.
Request for a list of non-consumed items, which have not been normally consumed (delivered, or provided) after purchase. In case of non-purchased items, ask the game server (item server) to proceed with item delivery (supply).
Since Added 2.14.0.
Call following API of an item to purchase by using itemId to send a purchase request. When a game user cancels purchasing, the PURCHASE_USER_CANCELED error will be returned.
Since Added 2.8.0.
TemporaryWithdrawal classes
If the user has requested to withdraw, cancel it. If the user has never requested to leave, the function call will fail.
Since Added 2.9.0.
Request to Temporary Withdrawal. If the user who requested the temporary withdrawal logs in, you can check the grace expiration time through the AuthToken.member.temporaryWithdrawalInfo.gracePeriodDate.
Since Added 2.9.0.
This function ignores the withdrawal grace period and proceeds withdrawal immediately.
Since Added 2.9.0.
This method shows alert using browser API alert().
Since Added 2.0.0.
This method shows confirm alert using browser API confirm().
Since Added 2.0.0.
Add a Gamebase event handler to be called when every events are arrived.
SERVER_PUSH : Receive messages from the Gamebase server.
OBSERVER : This is an event that fires when the launch, login account(hearbeat), or network connection 'status changes', webview event, introspect fail event.
Since Added 2.10.0.
toast.Gamebase.addEventHandler((message) => { const category = message.category; const data = message.data; switch (category) { case GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT: // Kicked out from Gamebase server.(Maintenance, banned or etc..) // Return to title and initialize Gamebase again. break; case GamebaseEventCategory.SERVER_PUSH_TRANSFER_KICKOUT: // If the user wants to move the guest account to another device, // if the account transfer is successful, // the login of the previous device is released, // so go back to the title and try to log in again. break; case GamebaseEventCategory.OBSERVER_LAUNCHING: checkLaunchingStatus(JSON.parse(message.data)); break; case GamebaseEventCategory.OBSERVER_NETWORK: checkNetworkStatus(JSON.parse(message.data)); break; case GamebaseEventCategory.OBSERVER_HEARTBEAT: checkHeartbeat(JSON.parse(message.data)); break; case GamebaseEventCategory.OBSERVER_INTROSPECT: // Introspect error var observerData = JSON.parse(message.data); var errorCode = observerData.code; var errorMessage = observerData.message; break; } }); function checkLaunchingStatus(data) { var code = data.code; var isPlayable = toast.GamebaseLaunching.isPlayable(code); if (isPlayable) { // 'The Game is playable' } else { // 'The Game is not playable' } } function checkHeartbeat(data) { var code = data.code; if (code === toast.GamebaseConstant.INVALID_MEMBER) { // You should to write the code necessary in game. (End the session.) } else if (code === toast.GamebaseConstant.BANNED_MEMBER) { // The ban information can be found by using the GetBanInfo API. // Show kickout message to user and need kickout in game. } else { console.log('Heartbeat code: ' + code); } } function checkNetworkStatus(data) { var code = data.code; if (code === toast.GamebaseNetworkType.TYPE_NOT) { // Network disconnected } else { // Network connected } }