Timer

Timer is a utility class to time events. It is available both on the server and the client.

A timer instance can be used in two ways:

instance

elapsed(name?: string): number in milliseconds

This returns the total elapsed time for the given timer, or the default total timer if no timer name is given.

lap(name: string): void

This stops the given timer. If the timer was not started, the timer is considered to have been started when the last call to lap() was made (or when the timer was created if this is the first lap() call).

log(): void

This logs the current timer status to the console.

start(name?: string): void

This starts a timer with the given name, or if no name is provided, the default total timer.

stop(name?: string): void

This stops a timer with the given name, or if no name is provided, the default total timer.

toString(): void

This returns a summary of the current timers.