Moeen Chat Service - v1.0.0
    Preparing search index...
    • Sleeps for a given number of milliseconds.

      Parameters

      • ms: number

        The number of milliseconds to sleep.

      • Optionalsignal: AbortSignal

        The abort signal to listen to.

      • throwOnAbort: boolean = false

        Whether to throw an error if the sleep is aborted.

      Returns Promise<void>

      A promise that resolves after the given number of milliseconds.

      sleep(1000) // Waits for 1 second
      sleep(500) // Waits for 0.5 seconds

      sleep(1000, signal, true) // Throws an error if the sleep is aborted
      sleep(1000, signal, false) // Resolves without throwing an error