Last active
January 24, 2017 17:43
-
-
Save iampava/f4cb74258a614f2deed30a4e9a2fa148 to your computer and use it in GitHub Desktop.
Skydiving through the Promise Land - timeout
This file contains hidden or 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
var hasHeLanded = false; | |
function takeOff() { | |
setTimeout(function () { | |
hasHeLanded = true; | |
console.log("I just landed! Woooho!"); | |
}, 5000); | |
} | |
function callFriendAndTalkVeryExcitedlyAboutYourPrototype() { | |
console.log("Hey friend, you will not believe what my mind stumbled upon..."); | |
} | |
var keepCalling = setInterval(function callAirfield() { | |
if (hasHeLanded) { | |
callFriendAndTalkVeryExcitedlyAboutYourPrototype(); | |
clearInterval(keepCalling); | |
} | |
}, 500); | |
takeOff(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment