# Mini-Program Delegation Management
Certain functionalities of Mini-Programs require implementation by the native side to be invoked, such as forwarding and obtaining user information from the Host-App.
Additionally, some functionalities can be opened up for App developers to customize.
# 1 Setting up open-type for Mini-Program button to obtain user avatar
Example
MopSdk.setChooseAvatar(chooseAvatar)
Parameters
| Configuration Name | Type | Configuration Description |
|---|---|---|
| chooseAvatar | String | Avatar |
# 2 Setting up open-type delegation trigger for Mini-Program button sharing
Example
MopSdk.setOpenTypeShareAppMessage((ret) => {
})
Parameters
| Configuration Name | Type | Configuration Description |
|---|---|---|
| shareCallback | Function | Sharing trigger delegation callback |
# 3 Setting up delegation trigger for Mini-Program menu sharing
Example
MopSdk.setShareAppMessage((ret) => {
})
Parameters
| Configuration Name | Type | Configuration Description |
|---|---|---|
| shareCallback | Function | Sharing trigger delegation callback |
# 4 Setting up open-type for Mini-Program button to obtain user information
Also applicable to the following APIs:
getUserInfo
getUserProfile
Example
MopSdk.setShareAppMessage({
name: 'xxx',
sex: '',
...
})
Parameters
| Configuration Name | Type | Configuration Description |
|---|---|---|
| options | Object | User information |
# 5 Close button callback
Example
MopSdk.setNavigationBarCloseButtonClicked((ret)=>{
})
Parameters
| Configuration Name | Type | Configuration Description |
|---|---|---|
| callback | Function | Close click callback |
# 6 Setting up custom menu buttons for Mini-Program
Example
const options = [{
id: 'caidan',
title: 'Menu',
image: 'https:///ddddd.jpg',
type: 'ON_MINI_PROGRAM',
isEnable: true
}]
MopSdk.setRegisteredMoreMenuItems(options,(ret)=>{
})
Parameters
| Configuration Name | Type | Configuration Description |
|---|---|---|
| options | Array[MenuItem] | Menu information |
| onRegisteredMoreMenuItemClicked | Function | Menu click callback |
MenuItem Configuration
| Configuration Name | Type | Configuration Description |
|---|---|---|
| id | String | Menu identifier |
| title | String | Menu name |
| image | String | Menu icon |
| type | String | Menu type, default COMMON, options: COMMON, ON_MINI_PROGRAM |
| isEnable | boolean | Whether clickable, default true |
# 7 Setting up gray value for Mini-Program
Example
const options = [{
key: '',
value: ''
}]
MopSdk.setGrayAppletVersionConfigs(options)
Parameters
| Configuration Name | Type | Configuration Description |
|---|---|---|
| options | Array[GrayItem] | Menu information |
GrayItem Configuration
| Configuration Name | Type | Configuration Description |
|---|---|---|
| key | String | Gray rule ID identifier |
| value | String | Gray value |
# 8 Setting up retrieval of Mini-Program performance logs
Example
MopSdk.setPerformanceRecordsCallback((ret)=>{
})
Parameters
| Configuration Name | Type | Configuration Description |
|---|---|---|
| callback | Function | Callback function |
Key Field Descriptions for Performance Statistics Records
| entryType Metric Type | name Metric Name | Description |
|---|---|---|
| inner | processLaunch | Process startup time |
| navigation | appInfo | Mini-Program details interface |
| loadPackage | downloadPackage | Download Mini-Program (start) |
| navigation | frameworkInfo | Base Library details interface, no log entry if Base Library preloading is enabled |
| loadPackage | downloadFramework | Download Base Library, no log entry if Base Library preloading is enabled |
| loadPackage | unzipFramework | Unzip Base Library, no log entry if Base Library preloading is enabled |
| loadPackage | downloadPackage | Download Mini-Program (completion) |
| loadPackage | unzipApp | Unzip Mini-Program |
| navigation | appLaunch | Total startup duration |
| script | frameworkLoad | Base Library loading |
| script | evaluateScript | Execute JavaScript code |
| script | serviceLoad | Logic Layer execution duration |
| render | frameworkRenderLoad | View Layer Base Library loading duration |
| render | viewRender | View Layer execution duration |
| render | firstRender | View Layer Mini-Program loading duration |