• Wait for a condition and execute rest of the code.

    Parameters

    • conditionFunction: any

      A function that returns conditions to be waited for.

    • maxWait: any

      Max duration (in ms) to wait before promise resolves to avoid indefinite wait.

    Returns Promise<unknown>

    A promise that resolves after given condition in conditionFunction is satisfied or after the max wait time.