Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/private/EventDispatcher/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public function addListener(string $eventName,
$this->dispatcher->addListener($eventName, $listener, $priority);
}

public function removeListener(string $eventName,
callable $listener): void {
$this->dispatcher->removeListener($eventName, $listener);
}

public function addServiceListener(string $eventName,
string $className,
int $priority = 0): void {
Expand Down
8 changes: 8 additions & 0 deletions lib/public/EventDispatcher/IEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ interface IEventDispatcher {
*/
public function addListener(string $eventName, callable $listener, int $priority = 0): void;

/**
* @param string $eventName preferably the fully-qualified class name of the Event sub class
* @param callable $listener the object that is invoked when a matching event is dispatched
*
* @since 19.0.0
*/
public function removeListener(string $eventName, callable $listener): void;

/**
* @param string $eventName preferably the fully-qualified class name of the Event sub class to listen for
* @param string $className fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container
Expand Down