Last active
July 4, 2021 22:25
-
-
Save pavelfeldman/5149547a0c5886805c1a2f8099aa2f55 to your computer and use it in GitHub Desktop.
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
<button id=submit>Submit</button> | |
<div id=log style='white-space: pre'></div> | |
<script> | |
const button = document.getElementById('submit'); | |
button.addEventListener('mousedown', () => { | |
print('1. down'); | |
Promise.resolve().then(() => print('2. down task ends')); | |
}); | |
button.addEventListener('mouseup', () => { | |
print('3. up'); | |
Promise.resolve().then(() => print('4. up task ends')); | |
}); | |
button.addEventListener('click', () => { | |
print('5. click'); | |
Promise.resolve().then(() => print('6. click task ends')); | |
}); | |
const text = []; | |
function print(line) { | |
text.push(line); | |
document.getElementById('log').textContent = text.join('\n'); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment