开发者

Good resources on structuring asynchronous code?

One thing I keep running across is a stack of functions at the bottom of my code. I can man开发者_如何学Cge it pretty well but I think their are probably better standards and practice out there that will help when sharing code.

I was hoping to see how other people structure their code, or some resources on good techniques for writing async JS.


You could probably learn the most by reviewing the source code for some of the more popular Node modules on GitHub. Express and Connect come to mind. You could even look at the lib directory of Node itself.

Other than that, the best way to structure a 'stack' of functions that is starting to get overwhelming is to group the functions by purpose and place each group in its own module (and therefore, separate file).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜