Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@chestozo
Created June 5, 2019 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chestozo/f310d17bdf910f7725782ef42be08b65 to your computer and use it in GitHub Desktop.
Save chestozo/f310d17bdf910f7725782ef42be08b65 to your computer and use it in GitHub Desktop.
Measure time after click
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