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);

Arguments

  • id
    The ID for the specified event.

Return Value

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

Remarks

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.

Example

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);
},

See Also

Reference

Sys.EventHandlerList Class

Other Resources

Language Reference