Nodejs Callback or eventEmitter
Which is the best practice to write nodejs code.
There are so many callback in my curr开发者_运维百科ent code and reduced the readability.
Any suggestion?
Callback: Use a callback if you just want to execute some code at a certain time and you don't need to emit success or failure.
EventEmitter: Use this if your object emits lots of types of events.
Try to look at some flow control libraries and articles in answer to this question: Async programming paradigm with nodejs and redis-node.
精彩评论