Protected
stackthe stack in which we push timestamps.
Protected
Readonly
timea function that returns the current time
get the current time.
push the current time into the stack, and get the value of the current time returned.
push the current time into the stack, and get the time elapsed since the last push.
if this is the first push, then the returned value will be undefined
.
pop the top most time from the time stack.
if the time stack is empty, then an undefined
will be returned.
preview the top most time in the stack without popping.
if the time stack is empty, then an undefined
will be returned.
preview the time elapsed since the most recent push into the time stack, without popping.
if there is nothing in the time stack, then an undefined
will be returned.
a stopwatch class that provides convince methods for timing.
this module exports a global defaultStopwatch available to all importing scripts, which is beneficial if you want to use a single stop watch across many modules, otherwise, if you want a dedicated stopwatch, you can create a new instance of this class.
this stopwatch operates on the principals of a stack data-structure:
push
,pop
, andseek
the time.Delta
methods provide the elapsed time since the lastpush
.Example