Documentation

EmitterTrait

Table of Contents

Methods

addListener()  : $this
Add a listener for an event.
addOneTimeListener()  : $this
Add a one time listener for an event.
emit()  : EventInterface
Emit an event.
removeAllListeners()  : $this
Remove all listeners for an event.
removeListener()  : $this
Remove a specific listener for an event.
useListenerProvider()  : $this
Add listeners from a provider.

Methods

addListener()

Add a listener for an event.

public addListener(string $event, ListenerInterface|callable $listener[, int $priority = ListenerAcceptorInterface::P_NORMAL ]) : $this

The first parameter should be the event name, and the second should be the event listener. It may implement the League\Event\ListenerInterface or simply be "callable".

Parameters
$event : string
$listener : ListenerInterface|callable
$priority : int = ListenerAcceptorInterface::P_NORMAL
Return values
$this

addOneTimeListener()

Add a one time listener for an event.

public addOneTimeListener(string $event, ListenerInterface|callable $listener[, int $priority = ListenerAcceptorInterface::P_NORMAL ]) : $this

The first parameter should be the event name, and the second should be the event listener. It may implement the League\Event\ListenerInterface or simply be "callable".

Parameters
$event : string
$listener : ListenerInterface|callable
$priority : int = ListenerAcceptorInterface::P_NORMAL
Return values
$this

removeAllListeners()

Remove all listeners for an event.

public removeAllListeners(string $event) : $this

The first parameter should be the event name. All event listeners will be removed.

Parameters
$event : string
Return values
$this

removeListener()

Remove a specific listener for an event.

public removeListener(string $event, ListenerInterface|callable $listener) : $this

The first parameter should be the event name, and the second should be the event listener. It may implement the League\Event\ListenerInterface or simply be "callable".

Parameters
$event : string
$listener : ListenerInterface|callable
Return values
$this

        
On this page

Search results