function EventLoop::defer
Defer the execution of a callback.
The deferred callback MUST be executed before any other type of callback in a tick. Order of enabling MUST be preserved when executing the callbacks.
The created callback MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) right before the next tick. Deferred callbacks MUST NOT be called in the tick they were enabled.
Parameters
\Closure(string):void $closure The callback to defer. The `$callbackId` will be: invalidated before the callback invocation.
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 101
Class
- EventLoop
- Accessor to allow global access to the event loop.
Namespace
RevoltCode
public static function defer(\Closure $closure) : string {
return self::getDriver()->defer($closure);
}