event.hasListener
Determine if listeners exist for event
Description
returns tf = event.hasListener(src,EventName)true if
listeners exist for the specified event on the object src.
Otherwise, it returns false. When src is
an array, event.hasListener returns a logical
array the same size as src.
The class of src must define or inherit the
specified event. If src is a heterogeneous array,
the specified event must exist on the class of the array. event.hasListener cannot
find listeners for events that are defined by some, but not all objects
in the heterogeneous array.
event.hasListener respects the value of
the event.listener object Enabled property.
If you set the listener Enabled property to false, event.hasListener returns false for
that listener.
Examples
Input Arguments
Output Arguments
Limitations
event.hasListenermust haveNotifyAccessfor the event in question.event.hasListenerdoes not work with the predefined property events,PreSet,PostSet,PreGet,PostGet.event.hasListenerdoes not work with the predefined dynamic property eventsPropertyAddedandPropertyRemoved.Use
event.hasListeneronly with user-defined events.
Version History
Introduced in R2016a