Clear all listeners for the given event names by setting their array length to 0, WITHOUT deleting the keys. This keeps the eventListeners object in V8's fast-properties mode and avoids re-allocating the arrays on the next on() call. Use this for objects with a known fixed set of event names (e.g. CoreAnimation, CoreAnimationController).
Only writes arr.length = 0 when the array is non-empty -- skips the write (and the write barrier on old-gen objects) when already empty, which is the common case after unregisterAnimation() has removed all listeners.
Optionaldata: anyCheck whether this emitter has any listeners registered.
Optionalevent: stringOptional event name. When provided, checks only that event. When omitted, checks all events.
true if at least one listener is registered.
Optionallistener: EventListener
EventEmitter base class
Remarks
The
eventListenersmap is allocated lazily on the firston()call. Many objects (e.g. CoreNodes that never have listeners attached) avoid the cost of allocating an empty{}at construction time.