Documents for @litert/utils-async
    Preparing search index...
    • Bind a timeout to an asynchronous task.

      The real asynchronous task is still running even if the timeout is reached. If you wanna cancel/abort the task, you should consider using AbortController.

      Type Parameters

      • T

      Parameters

      • ms: number

        The timeout duration in milliseconds.

      • asyncTask: Promise<T> | (() => Promise<T>)

        The asynchronous task to execute, which can be a Promise or a function that returns a Promise.

      Returns Promise<T>

      A Promise with the result of the asynchronous task or a timeout error.

      If the asynchronous task does not complete within the specified timeout.