Skip to content

Sleep (pause execution)

ts
function Sleep(millisec: number): void;

Pauses the execution of the current SyncJS script for the specified number of milliseconds.

Unlike standard JavaScript, which lacks a true synchronous sleep function, SyncJS provides Sleep() to make it easy to delay script execution when needed.

Parameters

NameTypeDescription
millisecnumberNumber of milliseconds to pause execution.

Returns

This function does not return a value.

Example

ts
Log('Start');
Sleep(1000); // Pauses for 1 second
Log('End');

NOTE

Sleep() is synchronous and will block the script for the specified duration. Use with care in performance-sensitive scripts.