Export (0) Print
Expand All

Sys.EventHandlerList getHandler Method

Returns a single method that can be invoked to call all handlers sequentially for the specified event.

var e = new Sys.EventHandlerList();
var a = Sys.EventArgs.Empty;
e.addHandler(id, handler);
var f = e.getHandler(id);
if (f) f(this, a);

id

The ID for the specified event.

A single method that can be invoked to call all handlers sequentially for the specified event.

Call the getHandler method to raise events in an EventHandlerList object. You first call the getHandler method with the id parameter set to the identifier of the event to raise. You then call the method returned by getHandler to call all the handlers for the event in order.

You should call getHandler immediately before you call the returned method, in case there is any change to the contents of the Sys.EventHandlerList object.

The getHandler method raises only the events declared in a EventHandlerList instance and will not include handlers declared elsewhere.

The following example shows how to call the getHandler method in a custom control. This is part of a larger example found in the EventHandlerList class overview.


_clickHandler: function(event) {
    var h = this.get_events().getHandler('click');
    if (h) h(this, Sys.EventArgs.Empty);
},


Community Additions

Show:
© 2014 Microsoft