Stopwatch(digitsopt)

Stopwatch class, uses native node to replicate/extend previous performance now dependancy.

new Stopwatch(digitsopt)

Starts a new Stopwatch
Parameters:
Name Type Attributes Default Description
digits number <optional>
2 The number of digits to appear after the decimal point when returning the friendly duration
Since:
  • 0.4.0

Members

digits :number

The number of digits to appear after the decimal point when returning the friendly duration.

readonly duration :number

The duration of this stopwatch since start or start to end if this stopwatch has stopped.

readonly friendlyDuration :string

The duration formatted in a friendly string

readonly running :boolean

If the stopwatch is running or not

Methods

reset() → {Stopwatch}

Resets the Stopwatch to 0 duration (Returns a stopped state)
Returns:
Stopwatch

restart() → {Stopwatch}

Restarts the Stopwatch (Returns a running state)
Returns:
Stopwatch

start() → {Stopwatch}

Starts the Stopwatch
Returns:
Stopwatch

stop() → {Stopwatch}

Stops the Stopwatch, freezing the duration
Returns:
Stopwatch

toString() → {string}

Defines toString behavior o return the friendlyDuration
Returns:
string
Since:
  • 0.4.0