Link Search Menu Expand Document

danog\MadelineProto\Coroutine

Back to index

Author: Daniil Gentili daniil@daniil.it

Creates a promise from a generator function yielding promises.

When a promise is yielded, execution of the generator is interrupted until the promise is resolved. A success value is sent into the generator, while a failure reason is thrown into the generator. Using a coroutine, asynchronous code can be written without callbacks and be structured like synchronous code.

Method list:

  • fail(\Throwable $reason)
  • offsetGet(mixed $offset)
  • getTrace()
  • getFrame()
  • jsonSerialize()
  • onResolve()

Methods:

fail(\Throwable $reason)

Parameters:

  • $reason: \Throwable Failure reason.

See also:

  • \Throwable

offsetGet(mixed $offset)

Get data at an array offset asynchronously.

Parameters:

  • $offset: mixed Offset

getTrace()

Get current stack trace for running coroutine.

getFrame()

Get current execution frame.

jsonSerialize()

Obtain.

onResolve()


Generated by danog/phpdoc