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.hasListener
must haveNotifyAccess
for the event in question.event.hasListener
does not work with the predefined property events,PreSet
,PostSet
,PreGet
,PostGet
.event.hasListener
does not work with the predefined dynamic property eventsPropertyAdded
andPropertyRemoved
.Use
event.hasListener
only with user-defined events.
Version History
Introduced in R2016a