Closed darscan closed 11 years ago
I was just following in the trail of Q.js and when.js, which expose when()
as their adapter method. Their authors are leading the charge on the Promise/A+ specification, so I thought it best to match existing conventions.
In promise-as3, we have expanded the scope of what when() would normally do to include adapting other kinds of asynchronous operation tokens (not just values, Promises, and untrusted third-party Promises). For the AsyncToken case, it seemed a natural fit to make this method more powerful rather than introducing a new method. Even now, I'm not sure if I want to expand the syntactical noise by distinguishing this capability explicitly as adaptation.
Nice! I like the readability of When.all()
, When.any()
. For Deft JS, I went with Promise.all()
, Promise.reduce
and had been thinking of doing the same here. I could see going either way on this for #4 or #5.
Thanks for the suggestion!
I was just following in the trail of Q.js and when.js, which expose when() as their adapter method. Their authors are leading the charge on the Promise/A+ specification, so I thought it best to match existing conventions.
Agreed!
Even now, I'm not sure if I want to expand the syntactical noise by distinguishing this capability explicitly as adaptation.
Fair point.
This is pretty minor, and just a thought really, but
when
doesn't sound like an adapter to me.When
sounds very much likeany
/all
.In a closed-source implementation that I wrote for someone, I used
When
as a class to house:When.all()
,When.any()
etc