Lines Matching refs:eventName

30      * @param string $eventName
35 function on($eventName, callable $callBack, $priority = 100) { argument
37 if (!isset($this->listeners[$eventName])) {
38 $this->listeners[$eventName] = [
44 $this->listeners[$eventName][0] = false; // marked as unsorted
45 $this->listeners[$eventName][1][] = $priority;
46 $this->listeners[$eventName][2][] = $callBack;
54 * @param string $eventName
59 function once($eventName, callable $callBack, $priority = 100) { argument
62 $wrapper = function() use ($eventName, $callBack, &$wrapper) {
64 $this->removeListener($eventName, $wrapper);
69 $this->on($eventName, $wrapper, $priority);
94 * @param string $eventName
99 function emit($eventName, array $arguments = [], callable $continueCallBack = null) { argument
103 foreach ($this->listeners($eventName) as $listener) {
113 $listeners = $this->listeners($eventName);
142 * @param string $eventName
145 function listeners($eventName) { argument
147 if (!isset($this->listeners[$eventName])) {
152 if (!$this->listeners[$eventName][0]) {
155 … array_multisort($this->listeners[$eventName][1], SORT_NUMERIC, $this->listeners[$eventName][2]);
158 $this->listeners[$eventName][0] = true;
161 return $this->listeners[$eventName][2];
171 * @param string $eventName
175 function removeListener($eventName, callable $listener) { argument
177 if (!isset($this->listeners[$eventName])) {
180 foreach ($this->listeners[$eventName][2] as $index => $check) {
182 unset($this->listeners[$eventName][1][$index]);
183 unset($this->listeners[$eventName][2][$index]);
198 * @param string $eventName
201 function removeAllListeners($eventName = null) { argument
203 if (!is_null($eventName)) {
204 unset($this->listeners[$eventName]);