Dispatcher (Events)

Dispatcher

class Dispatcher implements Dispatcher (View source)

Methods

void __construct( Container $container = null)

Create a new event dispatcher instance.

void listen( string|array $events, mixed $listener, int $priority)

Register an event listener with the dispatcher.

bool hasListeners( string $eventName)

Determine if a given event has listeners.

void push( string $event, array $payload = array())

Register an event and payload to be fired later.

void subscribe( object|string $subscriber)

Register an event subscriber with the dispatcher.

mixed until( string $event, array $payload = array())

Fire an event until the first non-null response is returned.

void flush( string $event)

Flush a set of pushed events.

string firing()

Get the event that is currently firing.

array|null fire( string|object $event, mixed $payload = array(), bool $halt = false)

Fire an event and call the listeners.

array getListeners( string $eventName)

Get all of the listeners for a given event name.

mixed makeListener( mixed $listener)

Register an event listener with the dispatcher.

Closure createClassListener( mixed $listener)

Create a class based listener using the IoC container.

void forget( string $event)

Remove a set of listeners from the dispatcher.

void forgetPushed()

Forget all of the pushed listeners.

$this setQueueResolver( callable $resolver)

Set the queue resolver implementation.

Details

void __construct( Container $container = null)

Create a new event dispatcher instance.

Parameters

Container $container

Return Value

void

void listen( string|array $events, mixed $listener, int $priority)

Register an event listener with the dispatcher.

Parameters

string|array $events
mixed $listener
int $priority

Return Value

void

bool hasListeners( string $eventName)

Determine if a given event has listeners.

Parameters

string $eventName

Return Value

bool

void push( string $event, array $payload = array())

Register an event and payload to be fired later.

Parameters

string $event
array $payload

Return Value

void

void subscribe( object|string $subscriber)

Register an event subscriber with the dispatcher.

Parameters

object|string $subscriber

Return Value

void

mixed until( string $event, array $payload = array())

Fire an event until the first non-null response is returned.

Parameters

string $event
array $payload

Return Value

mixed

void flush( string $event)

Flush a set of pushed events.

Parameters

string $event

Return Value

void

string firing()

Get the event that is currently firing.

Return Value

string

array|null fire( string|object $event, mixed $payload = array(), bool $halt = false)

Fire an event and call the listeners.

Parameters

string|object $event
mixed $payload
bool $halt

Return Value

array|null

array getListeners( string $eventName)

Get all of the listeners for a given event name.

Parameters

string $eventName

Return Value

array

mixed makeListener( mixed $listener)

Register an event listener with the dispatcher.

Parameters

mixed $listener

Return Value

mixed

Closure createClassListener( mixed $listener)

Create a class based listener using the IoC container.

Parameters

mixed $listener

Return Value

Closure

void forget( string $event)

Remove a set of listeners from the dispatcher.

Parameters

string $event

Return Value

void

void forgetPushed()

Forget all of the pushed listeners.

Return Value

void

$this setQueueResolver( callable $resolver)

Set the queue resolver implementation.

Parameters

callable $resolver

Return Value

$this

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.1/Illuminate/Events/Dispatcher.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部