IEventDispatcher
in
Event dispatcher service of Nextcloud
Tags
Table of Contents
Methods
- addListener() : void
- addServiceListener() : void
- dispatch() : void
- dispatchTyped() : void
- Dispatch a typed event
- hasListeners() : bool
- removeListener() : void
Methods
addListener()
public
addListener(string $eventName, callable $listener[, int $priority = 0 ]) : void
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 = 0
-
The higher this value, the earlier an event listener will be triggered in the chain (defaults to 0)
Tags
addServiceListener()
public
addServiceListener(string $eventName, string $className[, int $priority = 0 ]) : void
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 \OCP\EventDispatcher\IEventListener that can be built by the DI container
- $priority : int = 0
-
The higher this value, the earlier an event listener will be triggered in the chain (defaults to 0)
Tags
dispatch()
public
dispatch(string $eventName, Event $event) : void
use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped
Parameters
- $eventName : string
- $event : Event
Tags
dispatchTyped()
Dispatch a typed event
public
dispatchTyped(Event $event) : void
Only use this with subclasses of \OCP\EventDispatcher\Event
.
The object's class will determine the event name.
Parameters
- $event : Event
Tags
hasListeners()
public
hasListeners(string $eventName) : bool
Parameters
- $eventName : string
-
preferably the fully-qualified class name of the Event sub class
Tags
Return values
bool —TRUE if event has registered listeners
removeListener()
public
removeListener(string $eventName, callable $listener) : void
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