Basic Utility
These basic utility APIs provide core functionality for networking and checking compatibility within the mini app environment.
Note: The TikTok Minis SDK is loaded from https://connect.tiktok-minis.com/drama/sdk.js. After initialization, the TTMinis object is mounted on the global scope. All APIs are accessed via the TTMinis.xxx namespace.
TTMinis.init(options)
Initializes the SDK. Authentication-related APIs require init to be called first.
Parameters
Field | Type | Description | Required |
|
| The client key obtained from the TikTok for Developers platform. | Yes |
Returns
void
Example
// index.html
<head>
<script src="https://connect.tiktok-minis.com/drama/sdk.js"></script>
<script>
TTMinis.init({
clientKey: 'your_client_key',
});
</script>
</head>TTMinis.canIUse(feature)
Checks whether the current runtime environment supports a specific capability or field.
Parameters
Field | Type | Description | Required |
|
| The capability path using dot notation, such as | Yes |
Returns
Field | Type | Description |
result |
| Whether the feature is available in the current version. |
Example
if (TTMinis.canIUse('createRewardedVideoAd')) {
console.log('Rewarded video ad is supported');
}
if (TTMinis.canIUse('authorize.object.scope')) {
console.log('authorize.scope field is supported');
}