Created
May 19, 2018 15:19
-
-
Save wizo06/355dbebbbfa14d5a7cb0c828a8f55444 to your computer and use it in GitHub Desktop.
snippet to test if a function has async calls inside it
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
var work = process._getActiveHandles().length + process._getActiveRequests().length; | |
foo(); | |
var newWork = (process._getActiveHandles().length + process._getActiveRequests().length) - work; | |
if(newWork > 0) { | |
console.log("asynchronous work took place."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment