IEventDispatcher

interface OCP\EventDispatcher\IEventDispatcher
Event dispatcher service of Nextcloud
Implemented by:OC\EventDispatcher\EventDispatcher
Source:lib/public/EventDispatcher/IEventDispatcher.php#35

Methods

public OCP\EventDispatcher\IEventDispatcher::addListener($eventName, $listener, $priority=0)
Source:

lib/public/EventDispatcher/IEventDispatcher.php#48

Parameters:
  • $eventName (string) preferably the fully-qualified class name of the Event sub class
  • $listener (callable) the object that is invoked when a matching event is dispatched
  • $priority (int) The higher this value, the earlier an event

listener will be triggered in the chain (defaults to 0)

Since:

17.0.0

public OCP\EventDispatcher\IEventDispatcher::removeListener($eventName, $listener)
Source:

lib/public/EventDispatcher/IEventDispatcher.php#59

Parameters:
  • $eventName (string) preferably the fully-qualified class name of the Event sub class
  • $listener (callable) the object that is invoked when a matching event is dispatched
Since:

19.0.0

public OCP\EventDispatcher\IEventDispatcher::addServiceListener($eventName, $className, $priority=0)
Source:

lib/public/EventDispatcher/IEventDispatcher.php#72

Parameters:
  • $eventName (string) preferably the fully-qualified class name of the Event sub class to listen for
  • $className (string) fully qualified class name (or ::class notation) of a OCPEventDispatcherIEventListener that can be built by the DI container
  • $priority (int) The higher this value, the earlier an event

listener will be triggered in the chain (defaults to 0)

Since:

17.0.0

public OCP\EventDispatcher\IEventDispatcher::dispatch($eventName, $event)
Source:

lib/public/EventDispatcher/IEventDispatcher.php#84

Parameters:
Since:

17.0.0

Deprecated:

21.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped

public OCP\EventDispatcher\IEventDispatcher::dispatchTyped($event)
Dispatch a typed event
Only use this with subclasses of ``\OCP\EventDispatcher\Event``.
The object’s class will determine the event name.
Source:

lib/public/EventDispatcher/IEventDispatcher.php#96

Parameters:
Since:

18.0.0