-
Notifications
You must be signed in to change notification settings - Fork 6
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
How does race() resolve things? #22
Comments
Another great question to discuss. The main use case that has informed this has been the following: const waitFor = fn => run(race(filter(fn, interval(250)), timeout(10000))
await waitFor(condition) Notably, since Emitter's are resolvable, in contrast to Promise.race if the condition is fulfilled sooner than the timeout, the timeout will be cleanly cleared, rather than left to prevent your process from exiting and still fire after 10 seconds. Likewise if the timeout fires first, the checking every 250ms will also stop.
|
race()
says that it resolves all the other emitters once the first one resolves.What does it resolve them to?
How does it resolve Promises?
If we don't want our emitter to be forcibly killed by race(), I suppose we can call
em.each()
to instead pass a child emitter, right?The text was updated successfully, but these errors were encountered: