Sleep

Sleeps the current thread for the specified duration in millisecons

Method Signature

Sleep(duration=[long])

Arguments

Argument
Type
Required
Description
Default

duration

long

true

The amount of time, in milliseconds to sleep the thread

Examples

Sleep for 5 seconds

Outputs the current date/time, sleeps for 5 seconds, then outputs the current date/time again.

<bx:script>
	writeOutput( now() );
	writeOutput( "<br />" );
	sleep( 5000 );
	writeOutput( now() );
</bx:script>

Additional Examples

Run Example

bx:timer label="Sleep for 1 second" type="inline" {
	sleep( 1000 );
}
// Sleep for 1 second: 1000ms
writeOutput( "<br>" );
bx:timer label="Sleep for 2.5 seconds" type="inline" {
	sleep( 2500 );
}
 // Sleep for 2.5 seconds: 2500ms

Last updated

Was this helpful?