This package has been deprecated

Author message:

ABANDONED: use p-wait-for instead

poll-until

1.0.0 • Public • Published

poll-until.js

What?

A last resort in lieu of Events or Promises.

I decided to turn one of my Gists into a reusable component.

/**
 * @param {Function} condition a function that returns `true` or `false`
 * @param {Number} [interval=197] the amount of time to wait between tests
 * @param {Function} callback a function to invoke when the condition returns `true`
 * @returns {Function} call this to stop early (but no earlier than first check)
 */
function pollUntil(condition, interval, callback)`

Where?

Tested in Internet Explorer 6, Node.JS 0.10.28 and Chrome 35. This tiny component is likely to work everywhere.

How?

Can be used as an AMD or Node.JS module, or directly as a browser global.

Browser

bower install poll-until --save
<script src="bower_components/poll-until/poll-until.js"></script>
<script>
pollUntil(/* ... */);
</script> 

Node.JS

npm install poll-until --save
var pollUntil = require('poll-until');
pollUntil(/* ... */);

Readme

Keywords

Package Sidebar

Install

npm i poll-until

Weekly Downloads

0

Version

1.0.0

License

BSD

Last publish

Collaborators

  • jokeyrhyme