Created
January 30, 2017 03:39
-
-
Save liondancer/aa250df299228a18d01ef709803a97c7 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(); | |
} | |
} | |
} else { | |
// 2nd inner loop | |
const secondInnerLoop = () => { | |
log2.asyncCal().then(log => { | |
if (log) { | |
// continue iterating current log | |
asyncMSG(); | |
} 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