Source

async/wait.js

"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
            ar[i] = from[i];
        }
    }
    return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Wait for some time in a promise style (timer)
 *
 * Reference: https://stackoverflow.com/a/38956190/9428719
 *
 * @param ms The time in milliseconds to wait
 * @param resolveValues The value(s) to resolve
 * @category async
 * @module wait
 */
function wait(ms) {
    var resolveValues = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        resolveValues[_i - 1] = arguments[_i];
    }
    return new Promise(function (resolve) {
        setTimeout.apply(void 0, __spreadArray([resolve, ms], resolveValues, false));
    });
}
exports.default = wait;