Skip to content
- Environment Detection: Always use
isInApp() to detect the runtime environment and ensure code compatibility.
- Asynchronous methods:
getEnv, getHostSettings, etc. return Promises and require await or .then().
- Cancel Listener:
onForeground, onBackground, and subscribe return a cancel function to be called when the component unmounts; onBackPressed uses offBackPressed() to cancel.
- TAB Page:
closePage() has no effect in the TAB page.
- Internal Interface:
onJSBridgeReady is automatically invoked by the SDK; business code should not call it explicitly.
- Timeout Handling: Asynchronous methods will be rejected and return a
TIMEOUT error after timeout. The timeout durations for each method are as follows:
- 5 seconds:
getEnv, getAppName, getAppIcon, getHostSettings/ByKey, fileExists, createDir, reportEvent, pay.getProviders, hideBannerAd
- 10 seconds:
requestShortUrl, requestShortUrlWithHtml, deleteFile, moveFile, listDir
- 30 seconds:
getFileMd5, readFile, writeFile, getAttribution, pay.restorePurchases, showBannerAd
- 60 seconds:
unzipFile, zipDir, requestLogin, showInterstitialAd
- 120 seconds:
showRewardAd, showRewardedInterstitialAd
- 190 seconds:
pay.purchase (Native IAP path, including the user’s operation time in the payment interface; the Web checkout inline path has no fixed timeout and uses polling based on pollInterval × maxPolls).
- No Timeout:
callHostMethod, downloadFile (long-running tasks, requiring business-layer control).