Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect examples #1

Open
marwan38 opened this issue Nov 6, 2024 · 0 comments
Open

Incorrect examples #1

marwan38 opened this issue Nov 6, 2024 · 0 comments

Comments

@marwan38
Copy link

marwan38 commented Nov 6, 2024

echo "Sending welcome email to {$event->email}\n";

I'm not too sure about this, I might be wrong. The examples provided don't use the API correctly, the EventLoop::delay() callback is what gets executed after the delay, it doesn't actually "sleep".

The correct example would be

use Amp\delay;

delay(0.5);
echo "...";

OR

use Revolt\EventLoop;

EventLoop::Delay(0.5, fn () => echo "...");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant