-
• #2
It could well be an issue - while promises have got quite a lot of use recently, I haven't personally used
.all
, and I guess there could be some problems. I'll file a bug to look into it - I'm quite busy now so may not get to fix it for a few weeks though.In the mean time, you could probably replace
Promise.all
with your own function if you wanted? -
• #3
Just looked at this, and:
var promise = new Promise( function(resolve,reject) { resolve(); } ); Promise.all( [promise] ).then( function() { print( "never called :-(" ); } )
Does work. My guess is the reason you're having problems is you're doing this at the root scope - effectively pasting in one command after the other. In that case,
var promise = new Promise( function(resolve,reject) { resolve(); } );
gets called first, and executes on its own. There's nothing linked to it so it just completes and everything is ok.Then, when you do
Promise.all
, it's already been resolved so nothing happens. If you just wrap the two commands in curly braces or execute them in a function, everything's fine. I'll try and add something to cope with that eventuality.As for the other bit, at the moment
Promise.all
doesn't return things in order - just in the order they complete. I'll try and fix that one too. -
• #4
If you get the latest build in an hour or so, this should all be fixed.
I'm in the process of migrating my modules from using callbacks to promises. The code looks much tidier.
But I run into trouble with
Promise.all(..)
First question: Why is there no output?
It works when I wrap the code into a function call:
Second question: The results of the promises seems to be circular shifted.