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):
wxobject 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-typesnpm 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
wxobject are a legacy compatibility feature for porting existing WeChat games.
- New projects must use the
TudadaSDKdirect call.- Only APIs registered up to v0.1.2 are available through the
wxobject. New APIs added from v0.1.3 onwards (accelerometer,checkFeature,getLaunchOptions, etc.) are exclusive toTudadaSDK.- The
wxcompatibility feature will only receive maintenance going forward; no new features will be added.
Complete wx Compatible API List (fixed as of v0.1.2)
| Category | API | Type |
|---|---|---|
| Auth | login | Async |
checkSession | Async | |
getUserInfo | Async | |
| Storage (Sync) | getStorageSync | Sync |
setStorageSync | Sync | |
removeStorageSync | Sync | |
clearStorageSync | Sync | |
getStorageInfoSync | Sync | |
| Storage (Async) | setStorage | Async |
getStorage | Async | |
removeStorage | Async | |
clearStorage | Async | |
| Cloud Storage | getTudadaStore | Sync (instance) |
| System Info (Sync) | getSystemInfoSync | Sync |
getWindowInfo | Sync | |
getAppBaseInfo | Sync | |
getDeviceInfo | Sync | |
| System Info (Async) | getSystemInfo | Async |
getWindowInfoAsync | Async | |
getAppBaseInfoAsync | Async | |
getDeviceInfoAsync | Async | |
| UI | getMenuButtonBoundingClientRect | Sync |
| Keyboard | showKeyboard | Async |
hideKeyboard | Async | |
onKeyboardInput / offKeyboardInput | Callback registration | |
onKeyboardConfirm / offKeyboardConfirm | Callback registration | |
onKeyboardComplete / offKeyboardComplete | Callback registration | |
| Clipboard | setClipboardData | Async |
getClipboardData | Async | |
| Device | vibrateShort | Async |
vibrateLong | Async | |
| Lifecycle | onShow / offShow | Callback registration |
onHide / offHide | Callback registration | |
exitMiniProgram | Async | |
restartMiniProgram | Async | |
| Audio | createInnerAudioContext | Sync (instance) |
| Ad | showRewardedAd | Async callback (recommended) |
showRewardedAdAsync | Async Promise | |
createRewardedVideoAd | Sync (instance, legacy) |
Unsupported APIs: Network APIs such as
wx.request(),wx.downloadFile()are not supported. Use the browser'sfetch/XMLHttpRequestdirectly. WeChat-specific permission APIs likewx.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 thewxobject. Ads (showRewardedAd,showRewardedAdAsync) must also be called directly from theTudadaSDKinstance.