• wrap an async function with timeout

    Type Parameters

    Parameters

    • runner: T

      async runner please, otherwise the timeout is not meaningful

    • timeout: number = ...

      timeout threshold in milliseconds, default value is 60 seconds

    Returns T

    5.15.0

    const f = timeout(async() => {}, 1000)
    // f() will throw error if the result is not resolved in one second