Created
November 9, 2019 07:50
-
-
Save chinchang/7e7cf9dc31b41f98d06ef5ac24b43a4d 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
async function loop() { | |
for (let i = 0; i < 10; i++) { | |
document.body.innerHTML += i + " "; | |
await waitForEvent(); | |
} | |
} | |
function waitForEvent() { | |
return new Promise(resolve => { | |
window.onclick = () => { | |
console.log("clicked"); | |
resolve(); | |
}; | |
}); | |
} | |
loop(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment