0
是否可以引用外部函數的上下文,而不用將上下文重新分配給某個局部變量?引用外部上下文而不重新分配
例如:
var objects = [];
// populate objects
Foo.prototype.bar = function() {
var outerObject = this;
$.each(objects, function() {
this.someMethod(outerObject);
});
};
哦,太棒了!我不知道那件事。 – TheOne
我不認爲這將與jQuery事件處理程序一起工作。 – TheOne
@Ramin爲什麼不呢?沒有任何與jQuery衝突。 – xdazz