PromisesDebuggerExtension icon indicating copy to clipboard operation
PromisesDebuggerExtension copied to clipboard

Catch promises inside |then| handlers

Open NekR opened this issue 11 years ago • 0 comments

This code produces 2 log promises instead of one.

Promise.resolve(123).then(function(val) {
    return new Promise(function(resolve) {
        setTimeout(function() {
            resolve(val + ' resolved 2');
        }, 2000);
    });
});

But in the mean time, this code should produce 2 log promises:

var outer;
Promise.resolve(123).then(function(val) {
    outer = Promise.resolve('foo');
    return 'bar';
});

NekR avatar Oct 19 '14 03:10 NekR