delay
  • 25 Oct 2020
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

delay

  • Dark
    Light
  • PDF

Article summary

Description

Delays script execution for a specified # of milliseconds.

Tip

1,000 milliseconds = 1 second


Input Parameters

NameTypeRequiredDescription
durationNumberYesTime (in milliseconds)

Returns

No return value.


Examples

// delay for .25 seconds
debug.delay(250);

// this code runs after delay is complete
...

Remarks

Notice

Delays are intended for testing purposes only and may not work in production environments. Please remove them from all production scripts.

In general, adding delays to your scripts is a bad idea - especially in production. They translate to poor user experiences and costly execution times.

Evidence suggests people are irritated by delays > 250 milliseconds.

Avoid delays completely in production.


What's Next