Closed
Description
There should be a way to print how much time has passed since a timer has started without removing the timer.
In Chrome calling timeEnd
currently doesn't remove the timer, so you can call timeEnd multiple times.
console.time("abc")
console.timeEnd("abc")
console.timeEnd("abc")
// abc: 0.006ms
// abc: 0.281ms
The timer is reset only when time
is called again with the same label. Firefox and Node remove the timer when timeEnd
is called, as the spec says.
To be able to see intermediate values the spec could either be changed to recommend Chrome's behavior, or a new timeLog
(or similar) function could be introduced, which prints the duration without affecting the timer itself.
console.time("abc")
console.timeLog("abc")
console.timeEnd("abc")