Stopwatch

Provides a set of methods that you can use to measure elapsed time.

Constructor
Stopwatch(start: bool = false)

Construct an Stopwatch

Parameters
start true to start the Stopwatch immediately. Default: false
Methods
start
void start()

Starts, or resumes, measuring elapsed time.

stop
void stop()

Stops measuring elapsed time.

reset
void reset()

Stops measurement and resets the elapsed time to zero.

restart
void restart()

Stops measurement, resets the elapsed time to zero, and starts measuring elapsed time.

elapsed
number elapsed()

Gets the total elapsed time in ms.

Return
number The total elapsed time
isRunning
bool isRunning()

Gets a value indicating whether the Stopwatch timer is running.

Return
bool true if is running
isElapsed
bool isElapsed(time: number)

Gets a value indicating whether the elapsed time has exceeded the specified time.

Parameters
time The time to check in ms.
Return
bool true if has elapsed

© 2024 - Macrorify by KoK-CODE