Last active
July 29, 2020 09:47
-
-
Save olamedia/e825cbd2e86ddf910376c3bbb8606292 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script> | |
function blockingClick(){ | |
console.log('blocking promise'); | |
(new Promise((resolve, reject) => { | |
let i = 0; | |
while (i++ < 10000000000){ | |
} | |
}).then(function(){ | |
console.log('resolved'); | |
})) | |
} | |
function isBlockingClick(){ | |
document.body.appendChild(document.createTextNode('Not blocked ')); | |
console.log('not blocked'); | |
} | |
function over(el){ | |
el.style.backgroundColor = "#0f0"; | |
el.style.color = "#fff"; | |
} | |
function out(el){ | |
el.style.backgroundColor = "#ccc"; | |
el.style.color = "#000"; | |
} | |
</script> | |
</head> | |
<body> | |
<button onclick="blockingClick();">Click me</button> | |
<button onclick="isBlockingClick();" onmouseover="over(this)" onmouseout="out(this)">not blocked?</button> | |
<body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment