Skip to main content

Overview

A guide for integrating Tudada services in H5/web browser games using the SDK

SDK Version: 0.1.5 Last Updated: 2026-03-30 Target Audience: H5 web game developers (Cocos Creator, Phaser, PixiJS, etc.) Supported Platforms: iOS, Android

Overview

TudadaSDK is an SDK for connecting games to Tudada services in H5/web browser environments. It also provides legacy compatibility with the WeChat Mini Game (wx) API, allowing WeChat games to be ported to the Tudada platform with minimal modifications. For new projects, use the TudadaSDK API directly.

Key Features

  • TudadaSDK Native API: Direct calls in the form of TudadaSDK.login() (recommended)
  • WeChat API Compatibility (Legacy): wx object compatibility for porting existing WeChat games
  • Auto Initialization: The SDK initializes automatically upon loading; use waitForReady() to wait for completion
  • TypeScript Support: Type autocompletion via the tudada-sdk-types npm package
  • Mobile Optimized: Optimal performance on iOS and Android environments

API Call Methods

The SDK supports two ways to call APIs:

// Method 1: Direct TudadaSDK call (recommended)
TudadaSDK.login({
success: (res) => console.log(res.code),
});

// Method 2: wx compatible call (legacy — for ported WeChat games only)
wx.login({
success: (res) => console.log(res.code),
});

wx Compatibility Legacy Notice

API calls through the wx object are a legacy compatibility feature for porting existing WeChat games.

  • New projects must use the TudadaSDK direct call.
  • Only APIs registered up to v0.1.2 are available through the wx object. New APIs added from v0.1.3 onwards (accelerometer, checkFeature, getLaunchOptions, etc.) are exclusive to TudadaSDK.
  • The wx compatibility feature will only receive maintenance going forward; no new features will be added.
Complete wx Compatible API List (fixed as of v0.1.2)
CategoryAPIType
AuthloginAsync
checkSessionAsync
getUserInfoAsync
Storage (Sync)getStorageSyncSync
setStorageSyncSync
removeStorageSyncSync
clearStorageSyncSync
getStorageInfoSyncSync
Storage (Async)setStorageAsync
getStorageAsync
removeStorageAsync
clearStorageAsync
Cloud StoragegetTudadaStoreSync (instance)
System Info (Sync)getSystemInfoSyncSync
getWindowInfoSync
getAppBaseInfoSync
getDeviceInfoSync
System Info (Async)getSystemInfoAsync
getWindowInfoAsyncAsync
getAppBaseInfoAsyncAsync
getDeviceInfoAsyncAsync
UIgetMenuButtonBoundingClientRectSync
KeyboardshowKeyboardAsync
hideKeyboardAsync
onKeyboardInput / offKeyboardInputCallback registration
onKeyboardConfirm / offKeyboardConfirmCallback registration
onKeyboardComplete / offKeyboardCompleteCallback registration
ClipboardsetClipboardDataAsync
getClipboardDataAsync
DevicevibrateShortAsync
vibrateLongAsync
LifecycleonShow / offShowCallback registration
onHide / offHideCallback registration
exitMiniProgramAsync
restartMiniProgramAsync
AudiocreateInnerAudioContextSync (instance)
AdshowRewardedAdAsync callback (recommended)
showRewardedAdAsyncAsync Promise
createRewardedVideoAdSync (instance, legacy)

Unsupported APIs: Network APIs such as wx.request(), wx.downloadFile() are not supported. Use the browser's fetch/XMLHttpRequest directly. WeChat-specific permission APIs like wx.authorize(), wx.getSetting() are also not supported. The accelerometer is provided through a TudadaSDK-specific interface (startAccelerometerSensor, etc.) that differs from the wx API (wx.startAccelerometer, etc.) and cannot be used through the wx object. Ads (showRewardedAd, showRewardedAdAsync) must also be called directly from the TudadaSDK instance.