I am working with Angular JS and need to know the status of a Promise object whether it is in Pending/Fulfilled/Rejected status?
In Chrome Developer tool ( v 60 ), What I currently do is
Select that variable and choose stored as global variable (
temp1
)temp1; Deferred {promise: Promise, resolve: ƒ, reject: ƒ, notify: ƒ}
write below statement to check the Promise object status .
temp1.then(() => { console.log('resolved'); }) .catch(()=> { console.info(''rejected'); });
Although this is working fine. But I am looking for any alternative / different approach which does the same but in shorter way.
temp1.isRejected // return true/false
temp1.isResolved // return true/false
I also checked one suggestion that we can write method in the console and can run with this temp1
variable but again for this, I need to write the method on each new tab which is also cumbersome.
any suggestion or help?