Class: Stopwatch
stopwatch/src.Stopwatch
Stopwatch class, uses native node to replicate/extend performance-now dependency.
Constructors
constructor
• new Stopwatch(digits?
)
Starts a new stopwatch
Parameters
Name | Type | Default value |
---|---|---|
digits | number | 2 |
Defined in
projects/utilities/packages/stopwatch/src/index.ts:25
Properties
#end
• Private
#end: null
| number
The end time of this stopwatch
Defined in
projects/utilities/packages/stopwatch/src/index.ts:20
#start
• Private
#start: number
The start time of this stopwatch
Defined in
projects/utilities/packages/stopwatch/src/index.ts:15
digits
• digits: number
The number of digits to appear after the decimal point when returning the friendly duration.
Defined in
projects/utilities/packages/stopwatch/src/index.ts:10
Accessors
duration
• get
duration(): number
The duration of this stopwatch since start or start to end if this stopwatch has stopped.
Returns
number
Defined in
projects/utilities/packages/stopwatch/src/index.ts:34
running
• get
running(): boolean
If the stopwatch is running or not.
Returns
boolean
Defined in
projects/utilities/packages/stopwatch/src/index.ts:41
Methods
reset
▸ reset(): Stopwatch
Resets the Stopwatch to 0 duration (Returns a stopped state)
Returns
Defined in
projects/utilities/packages/stopwatch/src/index.ts:57
restart
▸ restart(): Stopwatch
Restarts the stopwatch (Returns a running state)
Returns
Defined in
projects/utilities/packages/stopwatch/src/index.ts:48
start
▸ start(): Stopwatch
Starts the Stopwatch
Returns
Defined in
projects/utilities/packages/stopwatch/src/index.ts:66
stop
▸ stop(): Stopwatch
Stops the Stopwatch, freezing the duration
Returns
Defined in
projects/utilities/packages/stopwatch/src/index.ts:78
toString
▸ toString(): string
Defines toString behavior
Returns
string