Created
May 29, 2019 21:13
-
-
Save rgruesbeck/4f4532606b69e63d187c4ac51df7782c to your computer and use it in GitHub Desktop.
test touch delays
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
// https://dzone.com/articles/300-ms-click-delay-and-ios-8 | |
// https://patrickhlauke.github.io/touch/tests/results/ | |
// https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure | |
<button>Click</button> | |
<p style="color: black;">Delay was <span></span> milliseconds.</p> | |
<script> | |
var button = document.querySelector("button"), | |
span = document.querySelector("span"), | |
delay; | |
button.addEventListener("touchstart", function () { | |
delay = Date.now(); | |
}); | |
button.addEventListener("click", function () { | |
span.innerHTML = Date.now() - delay; | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment