added stopPropagation logic

pull/632/head
n0nag0n 3 weeks ago
parent 4b7cd68e24
commit 79efffc333

@ -33,7 +33,12 @@ class EventDispatcher
{
if (isset($this->listeners[$event]) === true) {
foreach ($this->listeners[$event] as $callback) {
call_user_func_array($callback, $args);
$result = call_user_func_array($callback, $args);
// If you return false, it will break the loop and stop the other event listeners.
if ($result === false) {
break; // Stop executing further listeners
}
}
}
}

Loading…
Cancel
Save