Function waitForDuration

  • Runs the specified function and will timeout if it takes longer than the specified wait time

    Type Parameters

    • TResult

    Parameters

    • fn: () => Promise<TResult>

      The function to run

    • maxWaitTimeInMS: number

      The maximum amount of time to wait for the function to resolve

    Returns Promise<undefined | Awaited<TResult>>

    Promise that resolves to the resolved value of the function or undefined if it ran longer than the specified wait time