HipByte / Flow

Cross-platform libraries for RubyMotion
BSD 2-Clause "Simplified" License
141 stars 29 forks source link

Adding a Promise library? #62

Open zetachang opened 7 years ago

zetachang commented 7 years ago

This might be helpful for composing async tasks.

lrz commented 7 years ago

Might be interesting indeed! If you wish to contribute it feel free :)

zetachang commented 7 years ago

Good to know!

Also, I think it might be helpful if async API could also return a Promise like React Native did (and still support callback/block API)

Location.geocode('apple inc').then do |location|
  puts location.address
end.rescue |error|
  puts error
end
lrz commented 7 years ago

Indeed, we could change the existing APIs to return a Promise instead. But I guess we need to figure out the initial API and implementation first.