Use the following code:
this.AddMethod("custom_method", function(){});
this.AttachEventHandler("custom_event", "custom_method");
The physical renderer or the plug-in wrapper triggers these handlers when the following code is executed:
this.GetPM().OnControlEvent("custom_event", param1, param2)
The presentation model uses the custom_method to identify the function that it must call and when to call it. The presentation model also sends the parameters that OnControlEvent provides. For more information, see AttachEventHandler Method.