Skip to content

Instantly share code, notes, and snippets.

@iampava
Last active January 24, 2017 17:43
Show Gist options
  • Save iampava/f4cb74258a614f2deed30a4e9a2fa148 to your computer and use it in GitHub Desktop.
Save iampava/f4cb74258a614f2deed30a4e9a2fa148 to your computer and use it in GitHub Desktop.
Skydiving through the Promise Land - timeout
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