"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveWhen = void 0;
async function resolveWhen(condition, timeout) {
    return new Promise((resolve, _reject) => {
        if (condition()) {
            resolve();
            return;
        }
        const check = () => setTimeout(() => {
            if (condition()) {
                resolve();
            }
            else {
                check();
            }
        }, timeout);
        check();
    });
}
exports.resolveWhen = resolveWhen;
//# sourceMappingURL=resolve-when.js.map