1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 06:59:01 +01:00

Add continue constant to genericloop

This commit is contained in:
Daniil Gentili 2019-06-02 13:45:12 +02:00
parent e6375a4701
commit 33041140e2
3 changed files with 11 additions and 3 deletions

View File

@ -19,6 +19,7 @@
* split acks
* TL callabck
* channel state
* logger
Things to expect in the next releases:
Document async apis
optional max_id and min_id

View File

@ -29,6 +29,7 @@ class GenericLoop extends ResumableSignalLoop
{
const STOP = -1;
const PAUSE = null;
const CONTINUE = 0;
protected $callback;
protected $name;
@ -36,9 +37,15 @@ class GenericLoop extends ResumableSignalLoop
/**
* Constructor
*
* The callback will be bound to the GenericLoop instance: this means that you will be able to use `$this` as if the callback were actually the `loop` function (you can access the API property, use the pause/waitSignal methods & so on).
* The return value of the callable can be:
* A number - the loop will be paused for the specified number of seconds
* GenericLoop::STOP - The loop will stop
* GenericLoop::PAUSE - The loop will pause forever (or until the `resume` method is called on the loop object from outside the loop)
* GenericLoop::CONTINUE - Return this if you want to rerun the loop without waiting
*
* @param \danog\MadelineProto\API $API Instance of MadelineProto
* @param callback $callback Callback to run periodically
* @param int $timeout Timeout
* @param callback $callback Callback to run
* @param string $name Fetcher name
*/
public function __construct($API, $callback, $name)

View File

@ -35,7 +35,7 @@ abstract class Loop implements LoopInterface
private $count = 0;
protected $API;
public $API;
public function __construct($API)
{
$this->API = $API;