Created
June 5, 2019 10:27
-
-
Save chestozo/f310d17bdf910f7725782ef42be08b65 to your computer and use it in GitHub Desktop.
Measure time after click
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
document.addEventListener('click', () => { | |
const dt = Date.now(); | |
const clockElement = document.createElement('div'); | |
Object.assign(clockElement.style, { | |
position: 'absolute', | |
top: 0, | |
right: 0, | |
background: '#FAA', | |
'z-index': 9999, | |
padding: 5 | |
}); | |
document.body.appendChild(clockElement); | |
setInterval(() => { | |
clockElement.innerText = Date.now() - dt; | |
}, 50); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment