Created
November 20, 2020 15:32
-
-
Save agazso/486f8cc7417d5493a1d3a16af2f48e95 to your computer and use it in GitHub Desktop.
Performance logging in Typescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dates = [] | |
const logDates = () => dates.forEach((datePair, index) => { | |
if (index === 0) { | |
console.debug(datePair[0], datePair[1]) | |
} else { | |
console.debug(datePair[0], datePair[1], 'elapsed: ' + (datePair[1] - dates[index - 1][1])) | |
} | |
if (index === dates.length - 1) { | |
console.debug('total', 'elapsed: ' + (datePair[1] - dates[0][1])) | |
} | |
}) | |
dates.push(['enter', Date.now()]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment