Created
December 2, 2020 16:45
-
-
Save sospedra/a3b7523c5d412aea3c9a3fe6162ed1f8 to your computer and use it in GitHub Desktop.
console.log but outputs time differences
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 time = (() => { | |
let mark | |
return (...msgs: any[]) => { | |
if (!mark) { | |
mark = new Date().getTime() | |
} | |
const now = new Date().getTime() | |
console.log(`${(now - mark) / 1000 % 60}s`, ...msgs) | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment