google / promises

Promises is a modern framework that provides a synchronization construct for Swift and Objective-C.
Apache License 2.0
3.8k stars 295 forks source link

Need the observer api #153

Open AirChen opened 4 years ago

AirChen commented 4 years ago

In This Case:

When I develop a POI search function of a Driver Guidance Application , there is some difference POI requests . I used the promise to implement those difference requests , but every result of each request is tightly following it's request .👻 I want to integrate all results together , to display different UI in the common View . So I need a new API to observe all promise handled cases .

shoumikhin commented 4 years ago

Hi AirChen, is there a reason you don't want to simply chain the same block on all promises you're interested in, but rather prefer an observer object to store such blocks and chain the observer for each promise instead?

AirChen commented 4 years ago

@shoumikhin Thanks for your reply , but in some case that you have a branch of promises to request a list of items , and all blocks are needed for this function . Putting those blocks together could be better , in my opinion. 😁

AirChen commented 4 years ago

For this pull request https://github.com/google/promises/pull/152

ykjchen commented 4 years ago

@AirChen are there other promises libraries with similar API? I'm wondering if this is common; I'd be interested in looking through discussions other folks have had about this pattern.

AirChen commented 4 years ago

Emmm… Sometime , I think those APIs is better for debugging…