Renamed events in GroupManager
This commit is contained in:
@ -13,11 +13,11 @@ class GroupManager implements EventEmitterInterface
|
||||
/**
|
||||
* @var string emitted when a new group is created
|
||||
*/
|
||||
const EVENT_CREATED = 'created';
|
||||
const EVENT_CREATE = 'create';
|
||||
/**
|
||||
* @var string emitted after the last member leaves, when the group is destroyed
|
||||
*/
|
||||
const EVENT_DESTROYED = 'destroyed';
|
||||
const EVENT_DESTROY = 'destroy';
|
||||
|
||||
/** @var array<string,ConnectionGroup> */
|
||||
private array $groups = [];
|
||||
@ -31,13 +31,13 @@ class GroupManager implements EventEmitterInterface
|
||||
$group->on(ConnectionGroup::EVENT_LEAVE, function () use ($group) {
|
||||
Loop::futureTick(function () use ($group) {
|
||||
if (count($group) === 0) {
|
||||
$this->emit(self::EVENT_DESTROYED, [ $group ]);
|
||||
$this->emit(self::EVENT_DESTROY, [ $group ]);
|
||||
$group->removeAllListeners();
|
||||
unset($this->groups[$group->getName()]);
|
||||
}
|
||||
});
|
||||
});
|
||||
$this->emit(self::EVENT_CREATED, [ $group ]);
|
||||
$this->emit(self::EVENT_CREATE, [ $group ]);
|
||||
} else {
|
||||
$group = $this->groups[$name];
|
||||
}
|
||||
|
Reference in New Issue
Block a user