debugging-aid
Version:
Experimental tools for debugging Node.js apps without pausing
17 lines (14 loc) • 346 B
JavaScript
const { printMessage } = require('./lib/print')
let count = 0
const asyncHooks = require('async_hooks')
const asyncHook = asyncHooks.createHook({
init (asyncId, type, triggerAsyncId) {
if (type === 'PROMISE') {
count++
}
}
})
asyncHook.enable()
process.on('beforeExit', () => {
printMessage(`promises created: ${count}`)
})