function EventLoop::repeat
Repeatedly execute a callback.
The interval between executions is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be determined by which timers expire first, but timers with the same expiration time MAY be executed in any order. The first execution is scheduled after the first interval period.
The created callback MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) right before the next tick. Callbacks MUST NOT be called in the tick they were enabled.
Parameters
float $interval The time interval, in seconds, to wait between executions.:
\Closure(string):void $closure The callback to repeat.:
Return value
string A unique identifier that can be used to cancel, enable or disable the callback.
File
-
vendor/
revolt/ event-loop/ src/ EventLoop.php, line 141
Class
- EventLoop
- Accessor to allow global access to the event loop.
Namespace
RevoltCode
public static function repeat(float $interval, \Closure $closure) : string {
return self::getDriver()->repeat($interval, $closure);
}