src/Event/EventTarget.php
/**
     * Unregisters a callback for a specified event on the current node.
     *
     * @param \Rowbot\DOM\Event\EventListener|callable(\Rowbot\DOM\Event\Event): void|null $callback
     * @param bool|array{capture?: bool}                                                   $options
     */
Unregisters a callback for a specified event on the current node.
Unregisters a callback for a specified event on the current node .
public function removeEventListener(string $type, $callback, $options = false): void
    {
        if ($callback === null) {
            return;
        }
        $capture = $this->flattenOptions($options);
        if (is_object($callback) && $callback instanceof EventListener) {
            $callback = [$callback, 'handleEvent'];
        } elseif (is_callable($callback)) {
            $callback = $callback;
        } else {
            return;
        }
        $listener = new Listener($type, $callback, $capture);
        foreach ($this->listeners as $index => $eventListener) {
            if ($eventListener->isEqual($listener)) {
                $eventListener->setRemoved(true);
                array_splice($this->listeners, $index, 1);
                break;
            }
        }
    }
public function removeEventListener ( string $ type , $ callback , $ options = false ) : void { if ( $ callback === null ) { return ; } $ capture = $ this -> flattenOptions ( $ options ) ; if ( is_object ( $ callback ) && $ callback instanceof EventListener ) { $ callback = [ $ callback , 'handleEvent' ] ; } elseif ( is_callable ( $ callback ) ) { $ callback = $ callback ; } else { return ; } $ listener = new Listener ( $ type , $ callback , $ capture ) ; foreach ( $ this -> listeners as $ index => $ eventListener ) { if ( $ eventListener -> isEqual ( $ listener ) ) { $ eventListener -> setRemoved ( true ) ; array_splice ( $ this -> listeners , $ index , 1 ) ; break ; } } }
Unregisters a callback for a specified event on the current node.
Unregisters a callback for a specified event on the current node .
// If callback is null, terminate these steps.