Skip to content

jokeyrhyme/poll-until.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

poll-until.js

ABANDONED

Use p-wait-for instead

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(/* ... */);

About

last resort in lieu of events or promises

Resources

Stars

Watchers

Forks

Packages

No packages published