Now Playing Mario

    do-when

    1.0.0 • Public • Published

    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

    Keywords

    Install

    npm i do-when

    DownloadsWeekly Downloads

    1,041

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • segment-admin
    • ndhoule