pigato icon indicating copy to clipboard operation
pigato copied to clipboard

Callback functions

Open allain opened this issue 9 years ago • 0 comments

The use of callback functions when EventEmitters are readily available is problematic since there are limitations that are self imposed by using them.

  • Only one callback can be registered at a time since it's a simple variable.
  • If an error occurs during the processing of the callback, it can halt execution of the thing that's calling the callback, even through the failure of the callback should not directly impact the execution path. For ex: an error during onDisconnect in Worker will stop the "stop" event from ever going out. though technically all operations during the stop call could be done even if the callback had failed.

allain avatar Oct 05 '15 13:10 allain