|
@@ -93,7 +93,7 @@ class Event implements EventInterface
|
|
|
$timerId = $this->timerId++;
|
|
$timerId = $this->timerId++;
|
|
|
$event = new $className($this->eventBase, -1, $className::TIMEOUT, function () use ($func, $args, $timerId) {
|
|
$event = new $className($this->eventBase, -1, $className::TIMEOUT, function () use ($func, $args, $timerId) {
|
|
|
try {
|
|
try {
|
|
|
- $this->deleteTimer($timerId);
|
|
|
|
|
|
|
+ $this->offDelay($timerId);
|
|
|
$func(...$args);
|
|
$func(...$args);
|
|
|
} catch (\Throwable $e) {
|
|
} catch (\Throwable $e) {
|
|
|
Worker::stopAll(250, $e);
|
|
Worker::stopAll(250, $e);
|
|
@@ -109,7 +109,7 @@ class Event implements EventInterface
|
|
|
/**
|
|
/**
|
|
|
* {@inheritdoc}
|
|
* {@inheritdoc}
|
|
|
*/
|
|
*/
|
|
|
- public function deleteTimer($timerId)
|
|
|
|
|
|
|
+ public function offDelay($timerId)
|
|
|
{
|
|
{
|
|
|
if (isset($this->eventTimer[$timerId])) {
|
|
if (isset($this->eventTimer[$timerId])) {
|
|
|
$this->eventTimer[$timerId]->del();
|
|
$this->eventTimer[$timerId]->del();
|
|
@@ -122,6 +122,14 @@ class Event implements EventInterface
|
|
|
/**
|
|
/**
|
|
|
* {@inheritdoc}
|
|
* {@inheritdoc}
|
|
|
*/
|
|
*/
|
|
|
|
|
+ public function offRepeat($timerId)
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->offDelay($timerId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * {@inheritdoc}
|
|
|
|
|
+ */
|
|
|
public function repeat(float $interval, $func, $args)
|
|
public function repeat(float $interval, $func, $args)
|
|
|
{
|
|
{
|
|
|
$className = $this->eventClassName;
|
|
$className = $this->eventClassName;
|