Open GingerBear opened 10 years ago
我还是要好好看看javascript 的基础, 之前看过现在都不记得了。。。
用is-reader来看吧 :P On Oct 28, 2013, at 4:32 PM, etlds notifications@github.com wrote:
我还是要好好看看javascript 的基础, 之前看过现在都不记得了。。。
— Reply to this email directly or view it on GitHub.
@etlds 看到一篇总结js特性的文章,推荐一下。http://blog.leezhong.com/tech/2011/03/04/javascript.html
谢谢,我看看
@etlds 我刚看了一下authenticate的source:
https://github.com/jaredhanson/passport/blob/master/lib/passport/middleware/authenticate.js#L78
authenticate返回的也是一个authenticate函数,接受参数(req, res, next),callback被存到了closure里面,等内部的authenticate检查完login,剩下的就扔给这个custom callback来处理。
我觉得他这么写的原因,而不是直接把(req, res, next)作为第三个参数传入authenticate,是为了authenticate模块开发的方便,因为authenticate还要处理其他参数,比如option,如果再加入(req, res, next)的话开发就复杂了,而且使用起来也麻烦。