Comments (2)
Promise.all
with an array should work.
promises = user_ids.map { |id| get_json "/users/#{id}.json" }
Promise.all(promises)
.then { |u1, u2| puts "got users: #{u1}" }
.catch { |error| warn error }
If that doesn't work, let's discuss it on #9 or #5 (whichever Promise implementation you're using) since those haven't been merged yet.
I used that API because it matches the ES6 Promise
spec. I haven't really written it anywhere but a lot of stuff in Bowser is intended to be primarily a Ruby interface to browser APIs, so the browser's JS API is the interface I'm going for most of the time. This way, if you know the browser APIs, you probably know the Bowser APIs. If you don't, it should be easier to understand the browser API after learning the Ruby version. :-) I'm not sure why Opal's Promise
implementation deviates from ES6 here, tbh.
If #9 ends up getting merged, Bowser will move completely to use Bowser::Promise
(possibly even in the ServiceWorker
branch if I can swing it).
from bowser.
It seems that Opal's promise implementation deviates from ES6 since it provides the 'when'. So if Bowser::Promise is intended to replace Opal's Promise, it should at least be documented.
In my project, I have returned to Opals Promise and created an adapter to Dropbox v2 API.
from bowser.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bowser.