Created
January 30, 2017 03:41
-
-
Save liondancer/fda7e78b154b79c561b038227503a212 to your computer and use it in GitHub Desktop.
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
.then(() => { | |
var i = 0; | |
const whileHeapList = () => { | |
i++; | |
if (i < 5) { | |
// artifically delayed call | |
log.asyncCall().then(log => { | |
if (log) { | |
// first inner loop | |
const firstInnerLoop = () => { | |
if (j < 5) { | |
j++; | |
// continue iterating loop | |
firstInnerLoop(); | |
} | |
} | |
// call OUTTER loop | |
whileHeapList(); | |
} else { | |
// 2nd inner loop | |
const secondInnerLoop = () => { | |
log2.asyncCal().then(log => { | |
if (log) { | |
// continue iterating current log | |
secondInnerLoop(); | |
} else { | |
// break out of current loop and iterate OUTTER loop | |
whileHeapList(); | |
} | |
}); | |
} | |
} | |
}) | |
// continue iterating CURRENT loop --> whileHeapList | |
whileHeapList(); | |
} | |
}; | |
return new Promise(whileHeapList); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment