Get Mini Program Launch Options
methodName: getLaunchOptions
Additional Parameters:
None
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. |
query | String | The current mini program's query, parsed from the query field of the launch options. If there are no launch parameters, this will be an empty string. |
path | String | The current mini program's page address. |
scene_id | String | The launch scene. |
referrerInfo | Object | Information about the source of the launch. |
scene_id Scene Values
Scene Value | Scene Description |
---|---|
100000 | Default value when the scene cannot be determined |
100001 | Negative One-Screen Search |
100002 | Negative One-Screen Scan |
100003 | Negative One-Screen Feeds Card |
100004 | Negative One-Screen App Card |
100005 | Business Promotion |
100006 | Desktop Shortcut |
100007 | MiniAppCenter - Recently Used |
100008 | MiniAppCenter - My Favorites |
100009 | MiniAppCenter - Recommendations |
100010 | MiniAppCenter - Search |
Object referrerInfo
Property | Type | Description |
---|---|---|
appId | String | The appId of the source mini program |
extraData | Object | Data passed from the source mini program |
Object extraData (Default)
Property | Type | Description |
---|---|---|
query | String | The current mini program's query, parsed from the query field of the launch options. If there are no launch parameters, this will be an empty string. |
mode | String | Debug mode: DEBUG. If there are no launch parameters, this will be an empty string. |
version | String | The version number of the mini program dev version. If the mode is debug, a version number is required. |
page | String | The specified mini program address from social sharing. If there are no launch parameters, this will be an empty string. |
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('getLaunchOptions', {
success: (res) => {
console.log('Success: ', res);
},
fail: (res) => {
console.log('Fail: ', res);
},
complete: (res) => {
console.log('Complete: ', res);
},
});
}