promise-poll
Provides a function which resolves a promise which resolves within a given timeout if its predicate returns something truthy.
Installation
npm install promise-poll
Usage
var poll = ; ; { var diceRoll = Math + 1; return diceRoll % 2 ? diceRoll : false;}
API
poll(predicate, timeout[, interval:ms]) : Promise
predicate
a function which returns a truthy values, whose first truthy value will be used to resolve the Promise
timeout
the number of milliseconds to wait before declaring the Promise rejected
interval
the number of milliseconds between attempts to test the predicate