开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜