On 21 paź 2013, at 19:52, Reza Razavipour <[email protected]> wrote:

> we all of this I still can not figure out how to take an async function and 
> change it from callback to a promise.


Many libraries provide it's own utils for that, just check their documentation:

https://github.com/kriskowal/q#adapting-node
https://github.com/medikoo/deferred#promisify---working-with-asynchronous-functions-as-we-know-them-from-nodejs
https://github.com/petkaantonov/bluebird/blob/master/API.md#promisepromisifyfunction-nodefunction--dynamic-receiver---function


> 
> 1. Do I have to declare a promise before I can call a 'then' on it? Every 
> time I do not and call a then on an async function, I get a syntax error.
> 
> 
> 
> On Friday, October 18, 2013 3:11:47 PM UTC-7, Reza Razavipour wrote:
> I am a fairly new to javaScript and node.js both.
> 
> I am trying to wrap my head around promises and I am having a hard time. I am 
> looking for a very simple tutorial/video on this topic and having little 
> success.
> 
> Is there a reference that can be recommended? A before and after code snippet 
> can be a good starting position.
> 
> Reza
> 
> 
> 
> -- 
> -- 
> 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 a topic in the Google 
> Groups "nodejs" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/nodejs/Fx_SjgkXvKU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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/groups/opt_out.

Reply via email to