Promises/Deferreds are great for anything asynchronous. For example if I call a function that processes a large array then I'll use a timer to chunk the array so as not to lock up the UI but timers are async so the function would return immediately. If I use Promises then it doesn't matter because I can resolve() the data whenever it's ready.
On 29 Oct 2011, at 10:51, Rob Griffiths <[email protected]> wrote: > Actually I'm currently working on a node project and I've already hit the > dreaded nesting. Everything is callbacks. Im definatly seeing the benefits > for promises. > > I'd love to see some examples of promises being passed around in preference > to callbacks. > > -- > Rob Griffiths > Twitter: @bytespider > Github: https://github.com/bytespider > > bytespider.eu > Sent with Sparrow > On Friday, 28 October 2011 at 16:25, Dmitry Pashkevich wrote: > >> The benefit is visible but when looking at it I have fear that by using the >> Promises methodology (and in our case it's just a syntactic sugar for js) >> you can easily get tricked by thinking that actually asynchronous stuff is >> happening synchronously and eventually fall in your own traps. >> But I get the point, it's an interesting approach, thanks for sharing! >> -- >> To view archived discussions from the original JSMentors Mailman list: >> http://www.mail-archive.com/[email protected]/ >> >> To search via a non-Google archive, visit here: >> http://www.mail-archive.com/[email protected]/ >> >> To unsubscribe from this group, send email to >> [email protected] > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
