Attaching an Event Handler to an Event

This topic describes how to attach an event handler to an event.

To attach an event handler to an event

  • 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.