mathieuturcotte / node-wait Goto Github PK
View Code? Open in Web Editor NEWWaitForAll and WaitForAny on EventEmitter.
License: MIT License
WaitForAll and WaitForAny on EventEmitter.
License: MIT License
I've been using waitForAll
for a while in multiple situations, thank you for this convenient wrapper. I was wondering, would you be open to a PR that allows waitForAll
to start listening to emitters as soon as they're added?
My current problem is that I have an eventA
that triggers an eventC
, and an eventD
that is triggered both by the eventA
and an eventB
. I want to be able to know when eventC
and eventD
have happened but I have no right moment to start listening to them. If I start listening for eventC
as soon as eventA
happens, I don't have an handle on the listener for eventD
yet and if I wait for both eventA
and eventB
to happen before listening to eventC
and eventD
, I might miss eventC
altogether.
If waitForAll
would listen (probably through an option?) for events as soon as they're added and keep track of which have happened, a call to .wait()
would be able to callback properly immediately if it knows the events have already been fired. What do you think?
Thank you.
Infinity should set no timeout at all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.