UNPKG

@containernerds/incus-client

Version:

A Node.js client for automating Incus (LXD) servers.

15 lines (14 loc) 472 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.asyncPoll = void 0; // Async poll X times with a delay interval of Y seconds until condition is met const asyncPoll = async (condition, times, delay) => { for (let i = 0; i < times; i++) { if (await condition()) { return true; } await new Promise((resolve) => setTimeout(resolve, delay)); } return false; }; exports.asyncPoll = asyncPoll;