ChemPare Documentation - v0.0.0
    Preparing search index...

    Function delayAction

    • Delays the execution of an action by the specified number of milliseconds. Combines sleep() with a callback function for cleaner async code.

      Parameters

      • ms: number

        The number of milliseconds to delay

      • action: () => void

        The function to execute after the delay

      Returns Promise<void>

      A promise that resolves after the action is executed

      // Simple delay
      await delayAction(1000, () => console.log("Delayed message"));

      // With complex function
      await delayAction(500, () => {
      processData();
      updateUI();
      });

      // In a sequence
      await delayAction(100, step1);
      await delayAction(200, step2);