天蓬老师2017-04-17 16:04:27
看註解:
this
isreq
, which is a streamthis
isreq
, which is a stream
此时this
指向req
,而req
对外可以当做是stream
this
指向req
,而req
對外可以當做是stream
來用,就只是變個名字,看起來更清楚吧,沒啥特殊意義。 🎜迷茫2017-04-17 16:04:27
我只能說這個demo寫得爛,不必迷信&過度揣測其用意。
正常的類似的寫法是這樣的
var xx = function() {
var that = this;
return funtion() {
that.xxx
}
}
可以在閉包裡引用上層作用域的this