Détail du package

do-when

segmentio5.5kMIT1.0.0

Loop with setInterval until condition is true.

testing, test

readme

when

Loop with setInterval until condition is truthy. We use it to test that third-party libraries have loaded the proper global variables onto window.

Not great, I know. Have a better idea? Let me know.

Installation

$ npm install do-when
$ component install segmentio/when

Example

when(function () {
  return requirement() === met;
}, function () {
  doStuff();
});

API

when(condition, callback, [interval=10])

When condition returns truthy, call the callback. Check every interval milliseconds, defaulting to 10.

License

MIT