Usually you would use callbacks on any library call that needs them.  If
you have your own function that calls something async then it should have a
cb also, unless you don't care whether it finished or not or when.

There are lots of non-io async lib aync functions such as setTimeout.


On Tue, Apr 9, 2013 at 3:02 PM, Mil Werns <[email protected]> wrote:

> I have a simple question: When should I use callbacks?
>
> Currently, I'm only using callbacks in I/O cases (file, database and
> network access).
> My application has to iterate over a lot of big arrays and combines this
> data to new objects. I'm doing this with a standard (synchronous) for-loop,
> because this task needs only CPU power. So there would be no benefit to use
> an asynchronous call.
>
> Is this assumption correct?
> Can you please give me other examples for useful callbacks other than
> those mentioned above?
>
> Thank you
>
> --
> --
> 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.
>
>
>

-- 
-- 
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