When the someevent
event is fired I simply want to wait for the promise to be resolved before continuing. But slowFunctionThatReturnsPromise takes a long time to resolve and the overall process shuts down before it is resolved. Therefore it is never completed. I would have thought using a then
would wait for the promise to be resolved, but I can't figure out why it doesn't wait.
emitter.on('someevent', listener)
var listener = function()
{
x.slowFunctionThatReturnsPromise()
.then(function()
{
console.log('done');
})
}