
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@jcoreio/poll
Advanced tools
yet another promise-based poller (I didn't like the API design of others out there)
npm install --save @jcoreio/poll
const poll = require('@jcoreio/poll')
const superagent = require('superagent')
poll(() => superagent.get('http://google.com'), 1000)
.timeout(30000)
.then(() => console.log("You're connected to the internet!"))
poll(fn, interval, [options])Begins calling fn every interval milliseconds until the condition passes
(which defaults to fn didn't throw an Error or return a rejected Promise).
Returns a Promise that resolves when polling finishes or fails, which may be:
fn calls the pass method provided to itfn calls the fail method provided to itfn returns/resolves to a value or throws/rejects with an Error that
passes the conditionpoll times out waiting for any of the abovefn will be called with a context object:
{
attemptNumber: number, // the number of this call (starting from 0)
elapsedTime: number, // the number of milliseconds since polling started
pass: (value: any) => void, // makes `poll` resolve immediately with this value
fail: (error: Error) => void, // makes `poll` reject immediately with this Error
}
You can change the condition by calling .until on the returned Promise:
poll(...).until((error, result) => result > 3)
error will be the Error from the last call to fn (if it rejected or threw)
and result will be the value it resolved to or returned otherwise.
You can specify a timeout (in milliseconds) by calling .timeout on the returned Promise:
poll(...).timeout(30000) // time out after 30 seconds
If you call .noWrapError() on the returned Promise, it won't wrap rejection errors.
FAQs
handy promised-based polling API
The npm package @jcoreio/poll receives a total of 924 weekly downloads. As such, @jcoreio/poll popularity was classified as not popular.
We found that @jcoreio/poll demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.