[Dojo-interest] Becoming promises-aplus compliant
eugene.lazutkin at gmail.com
Tue Apr 23 14:36:19 EDT 2013
On 04/23/2013 12:09 PM, David McMullin wrote:
> > - I sometimes use setImmediate as a shorthand for this because, as I
> > have already mentioned and linked to here, there is already a utility
> > available for doing this cross browser
> > (https://github.com/NobleJS/setImmediate). Perfectly valid performance
> Right. It uses setTimeout() in its implementation.
> Yes, after exhausting all other options. So, you're worried about IE5.5?
Actually it is not true. All implementations (including the postMessage
one) call tasks.runIfPresent(handle), which calls setTimeout(0), if it
is not currently running a task, to chain itself. runIfPresent() is
defined in line 36, the call in question is done in line 53.
> > concerned were raised at the start of this thread and that (*not*
> > setTimeout directly) was the response, no one said "let's just use
> > setTimeout"...
> Yet you references suggest opposite. :-)
> see above ;)
Looking at it :-D
> Having said that I must admit that I am not against timeouts per se,
> and, yes, sometimes a delayed execution is a simplest solution possible.
> I just don't see it as a universal mechanism to cure all asynchronous
> That's fair, I appreciate you have a different point of view and the
> most logical result here might be everyone celebrating how great AMD is
> and just using whichever impl suits them the best.
> That's a fair concern, but I just took a look at the setImmediate
> utility's use of postMessage, and it's safe according to MDN =)
Yes. I have no problem with how that package uses it. It was a general
> Still is there a real need to bring a bunch of unrelated stuff in a
> simple concept? My guess is no, so let's agree to disagree. ;-) My
> understanding is that you are in the camp "let's bring all our toys out
> and use all of them" --- your choice, and I respect it.
> That sounds like a good plan to me, I would obviously prefer for
> dojo/Deferred to conform to promises/a+, but I'm happy to concede that
> there are good reasons for it not to. As Dan rightly said, my primary
> focus on this stage is ensuring the docs are informative.
More information about the Dojo-interest