Show Loading Toast
methodName: showLoading
Note: You need to actively call
hideLoadingto close the loading toast. Otherwise, it will automatically close after the specified duration.
Additional Parameters:
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| title | String | No | Content of the loading toast | |
| duration | Number | No | 3500 | Duration of the loading toast in milliseconds |
| mask | Boolean | No | true | Whether to show a transparent mask to prevent touch events |
Success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | String | Describes whether the interface call was successful or not. "true" for success, "false" for failure. |
Fail Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | String | Describes whether the interface call was successful or not. "true" for success, "false" for failure. |
| errMsg | String | Error message. |
Example Usage
const dlt = window['@transsion/byteh5bridge'];
const canCallDlt = dlt && window.dltms && window.dltms.isMiniShellGame();
if (canCallDlt) {
dlt.callApi('showLoading', {
title: 'Loading title',
duration: 5000,
success: (res) => {
console.log('Success: ', res);
},
fail: (res) => {
console.log('Fail: ', res);
},
complete: (res) => {
console.log('Complete: ', res);
},
});
}