output-sdk
    Preparing search index...

    Function sleep

    • Exports Temporal's sleep() function for advanced use cases. Pause workflow execution for a specified duration.

      Use this for delay-based throttling when calling external APIs.

      Parameters

      • ms: string | number

        Duration to sleep in milliseconds (or a string like '1s', '100ms')

      Returns Promise<void>

      A promise that resolves after the specified duration

      import { sleep } from '@output.ai/core';

      for ( const url of urls ) {
      await fetchUrl( url );
      await sleep( 100 ); // 100ms delay between calls
      }