• wrap an async function with timeout

    Type 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


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