Amp\Success::when PHP Method

when() public method

public when ( callable $onResolved )
$onResolved callable
    public function when(callable $onResolved)
    {
        try {
            $onResolved(null, $this->value);
        } catch (\Throwable $exception) {
            Loop::defer(static function () use($exception) {
                throw $exception;
            });
        }
    }