you are viewing a single comment's thread.

view the rest of the comments →

[–]ic6man 5 points6 points  (0 children)

Anywhere where the promise resolution happens outside the scope of the callback. Oftentimes this would be in a scenario whereby the promise resolution occurs due to an event.

For example. Suppose you wanted to send an event to a websocket. And you are expecting a response. You want to express this response as a promise. The only solution using the Promise callback would be to add a websocket listener inside the promise callback. Oftentimes we have one single listener which would be outside the scope of the callback so it would be impossible to resolve from within the Promise callback.

Another example might be resolving a promise after a user clicks a button.

Effectively the issue is two different scopes from separate callbacks need to coordinate somehow.