0
following code을 이해하려고합니다. 정확히 말하면 연구 방법은 $ .proxy()입니다. 나는이 스크립트를 가지고 때까지 모든 것이 분명했다 :이 상황에서 jQuery.proxy()는 어떻게 작동합니까?
(function($, exports){
var mod = function(){};
mod.fn = mod.prototype;
mod.fn.proxy = function(func){
return $.proxy(func, this);
};
mod.fn.load = function(func){
$(this.proxy(func));
};
exports.Controller = mod;
})(jQuery, window);
(function($, Controller){
var mod = new Controller;
mod.toggleClass = function(e){
this.view.toggleClass("over", e.data);
};
mod.load(function(){
this.view = $("#view");
this.view.mouseover(this.proxy(this.toggleClass));
this.view.mouseout(this.proxy(this.toggleClass));
});
})(jQuery, Controller);
를 그리고 나는 $ .proxy()이 부분에서 어떻게 작동하는지 이해가 안 :
mod.fn.load = function(func){
$(this.proxy(func)); // Why it is converted into an object jQuery?
};
는 사람이 어떻게 작동하는지 설명 할 수 있습니까?
감사합니다. 이제 나는 이해했다.)) –