Skip to content

Instantly share code, notes, and snippets.

@olamedia
Last active July 29, 2020 09:47
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 olamedia/e825cbd2e86ddf910376c3bbb8606292 to your computer and use it in GitHub Desktop.
Save olamedia/e825cbd2e86ddf910376c3bbb8606292 to your computer and use it in GitHub Desktop.
<!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