SharedEventManagerInterface
in
Interface for shared event listener collections
Table of Contents
- attach() : mixed
- Attach a listener to an event emitted by components with specific identifiers.
- clearListeners() : mixed
- Clear all listeners for a given identifier, optionally for a specific event
- detach() : mixed
- Detach a shared listener.
- getListeners() : array<string|int, mixed>
- Retrieve all listeners for given identifiers
Methods
attach()
Attach a listener to an event emitted by components with specific identifiers.
public
attach(string $identifier, string $eventName, callable $listener[, int $priority = 1 ]) : mixed
Parameters
- $identifier : string
-
Identifier for event emitting component
- $eventName : string
- $listener : callable
-
Listener that will handle the event.
- $priority : int = 1
-
Priority at which listener should execute
Return values
mixed —clearListeners()
Clear all listeners for a given identifier, optionally for a specific event
public
clearListeners(string $identifier[, null|string $eventName = null ]) : mixed
Parameters
- $identifier : string
- $eventName : null|string = null
Return values
mixed —detach()
Detach a shared listener.
public
detach(callable $listener[, null|string $identifier = null ][, null|string $eventName = null ]) : mixed
Allows detaching a listener from one or more events to which it may be attached.
Parameters
- $listener : callable
-
Listener to detach.
- $identifier : null|string = null
-
Identifier from which to detach; null indicates all registered identifiers.
- $eventName : null|string = null
-
Event from which to detach; null indicates all registered events.
Tags
Return values
mixed —getListeners()
Retrieve all listeners for given identifiers
public
getListeners(array<string|int, mixed> $identifiers, string $eventName) : array<string|int, mixed>
Parameters
- $identifiers : array<string|int, mixed>
- $eventName : string