Skip to content

Instantly share code, notes, and snippets.

@wizo06
Created May 19, 2018 15:19
Show Gist options
  • Save wizo06/355dbebbbfa14d5a7cb0c828a8f55444 to your computer and use it in GitHub Desktop.
Save wizo06/355dbebbbfa14d5a7cb0c828a8f55444 to your computer and use it in GitHub Desktop.
snippet to test if a function has async calls inside it
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