Last active
February 24, 2021 18:26
-
-
Save kibolho/abe3bfa9da80656148dcd499b8d2f515 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // timer.start('PROCESS'); | |
| // YOUR PROCESS TO MEASURE | |
| // timer.end(); | |
| import log from './log'; | |
| const logTimer = () => { | |
| let _initiTime: number; | |
| let _title = ''; | |
| const start = (title = '') => { | |
| _initiTime = Date.now(); | |
| _title = title; | |
| }; | |
| const end = () => { | |
| log(`${_title}: ${(Date.now() - _initiTime) / 1000} segundos`, ''); | |
| }; | |
| return { | |
| start, | |
| end, | |
| }; | |
| }; | |
| export default logTimer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment