why do we need to pass in window and undefined into this jquery plugin?

Viewed 1859

I'm looking at jquery resize plugin and can't understand certain things about how it works:

usually we only pass in Jquery object into jquery plugins, like this:

(function($){
    ....plugin code....
})(jQuery);

In "resize" plugin there are window and undefined objects being passed in:

(function($,window,undefined){
    ....plugin code....
})(jQuery,this);

IMHO - window is a global object anyway - why do we need to pass it in? the logic behind passing in undefined object I understand even less. I'm sure there's gotta be some reason for it - but I cannot think of any.

Can someone explain why is it being done?

1 Answers
Related