Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am reading Promise.all() guide but not seems what I need, I need to do something as console.log(Promise.LIST_OF_ALL_CREATED) and see a list (array or object) of all promises. I not know the promise IDs or variable names.

I need for debug list... And also for example, await all, or some selected ones.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
298 views
Welcome To Ask or Share your Answers For Others

1 Answer

The result of Promise.new() is just a reference to the promise. If you want to list all promises in an application, you need to get a reference to them when they're created.

Promise.all() is not related to getting all active promises in an application, it's used for something else.

There is no magical way to get a list of all "in flight" promises in an application. You just need to get the variable references, the same way you would do for any other variable.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...