Created
August 24, 2023 07:09
-
-
Save iamspark1e/b193fc1e7768446948b6a637a6288b00 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
let status = false; | |
let iframeReq = () => { | |
return new Promise((resolve, reject) => { | |
let timeout = 10; | |
let counter = 0; | |
let timer = setInterval(() => { | |
if(!status) { | |
if(counter < timeout) { | |
counter++; | |
} else { | |
reject(); | |
clearInterval(timer); | |
} | |
} else { | |
resolve(); | |
clearInterval(timer); | |
} | |
}, 1000) | |
}) | |
} | |
setTimeout(() => { | |
status = true | |
}, 5000) | |
iframeReq().then(() => {console.log(status)}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment