
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
wait-for-async
Advanced tools
import waitFor from `wait-for-async`;
await waitFor({ interval, condition, times });
Wait for condition()
to be true
.
Its value is checked every interval
milliseconds,
check no more than times
intervals in total.
Whenever condition()
becomes true
, return true
.
If condition()
never becomes true
until times
intervals passed, return false
.
The intervals (in milliseconds) on how often to check condition()
's value.
The default value is 100
.
At least 1 interval will be waited before condition()
is checked,
even if condition()
is true
at the very beginning.
condition()
is a method that returns true
or false
.
The default value is () => true
.
How many times in total to check condition()
's value before giving up.
The default value is Infinity
.
These are the maximum times to check. Fewer times to check if condition()
's value becomes true
sooner.
true
if condition()
becomes true
before giving up, otherwise return false
.
Or simply put, condition()
's value will be returned.
Wait for the download
to become true
(this variable should be updated by the file downloading code).
Check the download
value every second (the interval
's default value is 100ms), and give up after 60 seconds(60 checks).
await waitFor({ interval: 3000 });
FAQs
Async wait for
The npm package wait-for-async receives a total of 1,507 weekly downloads. As such, wait-for-async popularity was classified as popular.
We found that wait-for-async demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.