Improve docs

This commit is contained in:
Daniil Gentili 2019-06-03 20:51:21 +02:00
parent da911f8e77
commit f76840d014
2 changed files with 5 additions and 3 deletions

View File

@ -341,7 +341,7 @@ class MyLoop extends Loop
public function loop()
{
$MadelineProto = $this->API;
$logger = $MadelineProto->logger;
$logger = &$MadelineProto->logger;
$callable = $this->callable;
$result = null;
@ -442,7 +442,7 @@ class MySuperLoop extends ResumableSignalLoop
public function loop()
{
$MadelineProto = $this->API;
$logger = $MadelineProto->logger;
$logger = &$MadelineProto->logger;
while (true) {
$t = time();
@ -516,4 +516,4 @@ The return value of the callable can be:
* `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
<a href="https://docs.madelineproto.xyz/docs/CREATING_A_CLIENT.html">Next section</a>
<a href="https://docs.madelineproto.xyz/docs/CREATING_A_CLIENT.html">Next section</a>

View File

@ -189,6 +189,8 @@ $this->{'user2.madeline'}->messages->sendMessage(['peer' => '@danogentili', 'mes
If you intend to use your own constructor in the event handler, make sure to call the parent construtor with the only parameter provided to your constructor.
If you need to use the [__sleep](https://www.php.net/manual/en/language.oop5.magic.php#object.sleep) function, make sure it is called `__magic_sleep`, instead.
The update handling loop is started by the `$MadelineProto->loop()` method, and it will automatically restart the script if execution time runs out.
To break out of the loop just call `die();`, or throw an exception from within (make sure to catch it outside, in the `$MadelineProto->loop()` call).