Jquery resize event question

If I have a function called getWindowSize that runs after a browser resize:
$( window ).resize( (getWindowSize) );

How does it know to run after the DOM finishes loading with this code I have on the page:
$(document).ready(getWindowSize);

and instead of just running:
getWindowSize();

Basically how does it know to run $(document).ready(getWindowSize); and not just getWindowSize(); ?