I like this pattern for making nice utilities available on the function 
prototype. IMO it's the "safest" proto to modify. It would be handy in 
modules that do other specific function-wrapping things, like memoizing, 
currying, throttling, etc. This opinion is probably ripe for sparking nerd 
fights though.

:Marco

On Tuesday, October 1, 2013 10:53:28 AM UTC-7, Mikeal Rogers wrote:
>
> where this is a concern you should just use once. the request 3.0 branch 
> is doing so, as are several other projects i've written, and it works quite 
> well.
>
> https://npmjs.org/package/once
>
> -Mikeal
>
> On Oct 1, 2013, at 10:51AM, Oleg Slobodskoi 
> <[email protected]<javascript:>> 
> wrote:
>
> The answer depends on the reason why the callback called multiple times, 
> possible are:
> - by design
> - when multiple parallel running functions callback
>
>
> The last one could happen f.e. one of them fails and calls back with an 
> error, the other one calls back without error despite of the errored other 
> one. In this case you can't ignore either the first one or the second one.
>
> I had this situation often when dealing with event emitters and 
> transforming the results into single callback style.
>
> The only correct way is to fix the function which is causing this error.
>
>
> Best,
> Oleg Slobodskoi
>
> http://www.facebook.com/oleg.slobodskoi
> https://www.xing.com/profile/Oleg_Slobodskoi
> https://twitter.com/oleg008
> https://github.com/kof
>  
> Am 01.10.2013 um 07:17 schrieb jeevan kk <[email protected] <javascript:>
> >:
>
> I am using different 3rd party modules in my project. I have seen, in some 
> odd situations the 3rd party module which I am using is calling the 
> callback multiple times. 
>
> Is there any general approach which I can follow so avoid such situations. 
>
> -- 
> -- 
> 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] <javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> 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] <javascript:>.
> 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] <javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> 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] <javascript:>.
> 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