1.0.1 • Published 8 years ago

wait-until-async v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

About

This package allows you to wait for an async condition, exposing similar API as wait-promise package. Call every(100, 100).until(condition) translates to waitUntil(condtion, 100). See usage example below.

Usage

import waitUntil from 'wait-until-async'

var i = 0;
async function condition1() {
    i++;
    return i > 10;
}

Promise.resolve()
    .then(() => waitUntil(condition1, 100))
    .then(() => { if (i <= 10) throw "Wait didn't work"; })
    .then(() => console.log('success'))
    .catch(() => console.log('fail'));
1.0.1

8 years ago

1.0.0

8 years ago