Suspends (sleeps) script execution for a specified timeout or until a passed callback function returns true. This is an efficient way to wait for an event without burning CPU cycles.


printing.Sleep(timeout, [callback])

Parameter Description
timeout (Number) the timeout in milliseconds
callback [Optional] (Function) the optional pointer to the function to be periodically called within the Sleep method.
When the function returns true, the sleep is canceled.

Returns true if the sleep was canceled by a callback function.


The following code snippet navigates a frame to a file then prints its content: