Thank you very much for all the replies. This has been most enlightening.
Based on all of the replies and my situation I would like to explore
Promises more. I think I understand the basic idea behind promises but lack
specific implementation details. Does anyone have a good example of using Q
and Node.js like the readme indicates:
```javascript
step1(function (value1) {
step2(value1, function(value2) {
step3(value2, function(value3) {
step4(value3, function(value4) {
// Do something with value4
});
});
});
});
```
With a promise library, you can flatten the pyramid.
```javascript
Q.fcall(promisedStep1)
.then(promisedStep2)
.then(promisedStep3)
.then(promisedStep4)
.then(function (value4) {
// Do something with value4
})
.catch(function (error) {
// Handle any error from all above steps
})
.done();
```
I get lost with denodify and deferred which the above simplification
doesn't address. Any clarification for the newly initiated?
Thank you.
On Friday, April 18, 2014 1:55:07 PM UTC-5, Aria Stewart wrote:
>
>
> On Apr 18, 02014, at 14:52, Kevin Burton
> <[email protected]<javascript:>>
> wrote:
>
> > Alex, I think in this case I need to. I have about 20 functions to
> execute, each of which depends on the side-effects of the previous
> function. I can basically make it synchronous by making what looks like a
> big ‘V'
>
> Check out http://callbackhell.com
>
> You can also write a little glue (or use libraries) like async to do this
> a bit more tidily, or consider using Promises.
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.