Documentation

ListenerAcceptorInterface

Table of Contents

Constants

P_HIGH  = 100
High priority.
P_LOW  = -100
Low priority.
P_NORMAL  = 0
Normal priority.

Methods

addListener()  : $this
Add a listener for an event.
addOneTimeListener()  : $this
Add a one time listener for an event.

Constants

Methods

addListener()

Add a listener for an event.

public addListener(string $event, ListenerInterface|callable $listener[, int $priority = self::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". In this case, the priority emitter also accepts an optional third parameter specifying the priority as an integer. You may use one of our predefined constants here if you want.

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

addOneTimeListener()

Add a one time listener for an event.

public addOneTimeListener(string $event, ListenerInterface|callable $listener[, int $priority = self::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 = self::P_NORMAL
Return values
$this

        
On this page

Search results