Parameter | Type | Description |
---|---|---|
target | object | Object containing the event. |
eventName | string | String containing the event name. |
method | Delegate | Event handler method. |
To remove the handler from the event, use RemoveFromEvent.
This example adds a handler to the ImageChanged event of LEADTOOLS ImageViewer and then removes it.
example: function SiteLibrary_DefaultPage$example(viewer) { // The method to call on image changed var imageChangedHandler = null; imageChangedHandler = function(sender, e) { alert("Image has changed"); // Remove the event lt.LeadEventArgs.removeFromEvent(viewer, "imageChanged", imageChangedHandler); }; // Add a handler to the viewer.ImageChanged event lt.LeadEventArgs.addToEvent(viewer, "imageChanged", imageChangedHandler); // Set an image into the viewer and notice our alert viewer.set_imageUrl("Images/24.png"); },