/** * {@inheritDoc} */ public function hasListeners($eventName) { list($ns, $event) = Event::parseName($eventName); if ($ns) { return $this->evm->hasListeners($eventName) || $this->evm->hasListeners($event); } return $this->evm->hasListeners($this->namespace . $eventName) || $this->evm->hasListeners($eventName); }
/** * @return array|callable[] */ public function getListeners() { $listeners = $this->listeners; if ($this->panel) { $this->panel->inlineCallbacks($this->getName(), $listeners); } elseif (!$this->eventManager || !$this->eventManager->hasListeners($this->getName())) { return $listeners; } $name = $this->getName(); $evm = $this->eventManager; $argsClass = $this->argsClass; $globalDispatch = function () use($name, $evm, $argsClass) { if ($argsClass === NULL) { $args = new EventArgsList(func_get_args()); } else { $args = Nette\Reflection\ClassType::from($argsClass)->newInstanceArgs(func_get_args()); } $evm->dispatchEvent($name, $args); }; if ($this->globalDispatchFirst) { array_unshift($listeners, $globalDispatch); } else { $listeners[] = $globalDispatch; } return $listeners; }
public function hasListeners($eventName = null) { return $this->evm->hasListeners($eventName); }