triggering an error when done is called more times then expected is a difficult design.
If you call the callback once saying 'your done' and then again with an error saying 'woh, it was called too many times' then you break the environment of a callback being called once. If you throw, your being a dick and crashing the process in production. If you emit an error then the result has to be an EventEmitter and you have to document said error. The error of done being called too many times is also difficult to recover from because you already did the thing when your done. As for messing with the count ( https://github.com/Raynos/after/blob/master/lib/after.js#L4 ). It's just a numeric property, mutate it if it matches your use case. I think its bad to mutate it. On Sat, Feb 2, 2013 at 1:02 AM, Oleg Slobodskoi <[email protected]>wrote: > Haha, never seen "after", but the idea is similar, > > however "do" handles more cases: > > - increate later todo amount > - if the code is complicated, you don't want (or you can't) to set the > amount of todos at the beginning, but conditionally increment them > - it triggers an error if "done" is called more times than expected > > and still almost 0 overhead. > > > Am 02.02.2013 um 06:09 schrieb Jake Verbaten <[email protected]>: > > This is just a way more complex version of Raynos/after. ( > http://github.com/Raynos/after) > On Jan 31, 2013 9:47 AM, "Oleg Slobodskoi" <[email protected]> wrote: > >> If you don't want to use all the async/steper libraries but just want a >> reliable way to know when the function is done - this is for you. >> >> https://github.com/kof/do >> >> Feedback welcome. >> >> Oleg Slobodskoi >> >> @oleg008 >> >> -- >> -- >> 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. > > > > > -- > -- > 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.
