UNPKG

779 BJavaScriptView Raw
1"use strict";
2/**
3 * Copyright (c) 2019, Microsoft Corporation (MIT License).
4 */
5Object.defineProperty(exports, "__esModule", { value: true });
6function pollUntil(cb, timeout, interval) {
7 return new Promise(function (resolve, reject) {
8 var intervalId = setInterval(function () {
9 if (cb()) {
10 clearInterval(intervalId);
11 clearTimeout(timeoutId);
12 resolve();
13 }
14 }, interval);
15 var timeoutId = setTimeout(function () {
16 clearInterval(intervalId);
17 if (cb()) {
18 resolve();
19 }
20 else {
21 reject();
22 }
23 }, timeout);
24 });
25}
26exports.pollUntil = pollUntil;
27//# sourceMappingURL=testUtils.test.js.map
\No newline at end of file