\think\facadeEvent

Summary

Methods
Properties
Constants
__callStatic()
listenEvents()
listen()
hasListener()
remove()
bind()
subscribe()
observe()
trigger()
until()
No public properties found
No constants found
getFacadeClass()
createFacade()
$alwaysNewInstance
$instance
N/A
No private methods found
No private properties found
N/A

Properties

$alwaysNewInstance

$alwaysNewInstance : bool

始终创建新的对象实例

Type

bool

$instance

$instance

Methods

__callStatic()

__callStatic(mixed  $method, mixed  $params) : mixed

Parameters

mixed $method
mixed $params

Returns

mixed —

listenEvents()

listenEvents(array  $events) : \think\Event

批量注册事件监听

Parameters

array $events

Returns

\think\Event —

listen()

listen(string  $event, mixed  $listener, bool  $first = false) : \think\Event

注册事件监听

Parameters

string $event
mixed $listener
bool $first = false

Returns

\think\Event —

hasListener()

hasListener(string  $event) : bool

是否存在事件监听

Parameters

string $event

Returns

bool —

remove()

remove(string  $event) : void

移除事件监听

Parameters

string $event

bind()

bind(array  $events) : \think\Event

指定事件别名标识 便于调用

Parameters

array $events

Returns

\think\Event —

subscribe()

subscribe(mixed  $subscriber) : \think\Event

注册事件订阅者

Parameters

mixed $subscriber

Returns

\think\Event —

observe()

observe(string|object  $observer, null|string  $prefix = '') : \think\Event

自动注册事件观察者

Parameters

string|object $observer
null|string $prefix = ''

Returns

\think\Event —

trigger()

trigger(string|object  $event, mixed  $params = null, bool  $once = false) : mixed

触发事件

Parameters

string|object $event
mixed $params = null
bool $once = false

Returns

mixed —

until()

until(mixed  $event, mixed  $params) : mixed

触发事件(只获取一个有效返回值)

Parameters

mixed $event
mixed $params

Returns

mixed —

getFacadeClass()

getFacadeClass() : string

获取当前Facade对应类名(或者已经绑定的容器对象标识)

Returns

string —

createFacade()

createFacade(bool  $newInstance = false) : object

创建Facade实例

Parameters

bool $newInstance

是否每次创建新的实例

Returns

object —