0 karma · joined Aug 16, 2013 (13y ago) · 2 submissions
comment 13y ago · link · parent
Callbacks aren't bad. Pyramids are bad. Stop writing pyramids.
Nodejs also establishes a nice api for callback functions-- in particular, callbacks are defined with an `error` and a `data` argument. You handle the error if it is non-null, otherwise execute `data`.
If you want to avoid callbacks, Node also provides event emitters, and streams. Streams in particular provide a nice api for dealing with event based programming.