# Delegate Methods
Certain features of Mini-Programs require native-side implementation to be invoked, such as forwarding and obtaining user information from the Host-App.
Additionally, some features can be opened up for App developers to customize.
# 1. Setting Delegate Methods
const handler = {
forwardApplet(params) {
// Forward Mini-Program
var appletInfo = params.appletInfo;
var appId = appletInfo.appId;
},
getUserInfo(params) {
// Get user information
return {
name: 'jimmy',
nickName: 'jimmy chung',
avatarUrl: 'http://xxx.jpg',
};
},
getCustomMenus(appId) {
// Click menu
let list = [
{
menuId: 'menuid1',
image: 'image',
title: 'title',
type: 'type',
foo: 'foo',
},
{
menuId: 'menuid2',
image: 'image',
title: 'title',
type: 'type',
foo: 'foo',
},
];
return list;
},
onCustomMenuClick(appId,path,menuId,appInfo) {
// Click custom menu
console.log('onCustomMenuClick');
},
appletDidOpen(appId) {
// Mini-Program opened (iOS only)
console.log('appletDidOpen', params);
return params;
},
};
/**
* @param {Object} handler Contains the above event handler functions
**/
MopSDK.registerAppletHandler(handler);