TimeFunction: "perf" | "date" | (() => number)

the time function to use for your Stopwatch instance. it is best if it returns the time in milliseconds, so that the time scale can be consistient across various uses.

  • "perf" is equivalent to using the built-in performance.now function. (default)
  • "date" is equivalent to using the built-in Date.now function.
  • alternatively, you could define your own time function.