Lets just talked about how is it possible?
Suppose, you have more than one events which you want to call on when your page completely loaded. Lets examine this in JavaScript to get more about the concept and keep it simple to easy to understand.
var pageLoadEvents = [];
We have created an array where we will keep all our event which we want to call when page loaded.
pageLoadEvents.push( function() {
alert("hello!");
} )
And:
pageLoadEvents.push( function() {
alert("How are you doing?");
} )
Now, you have defined all your events that you would like to raise on page load and all of them are in a pageLoadEvents array. Here, we write our final piece:
window.onload = function() {
for(var index=0; index<pageLoadEvents.length; index++) {
pageLoadEvents[index]();
}
}
All events that we keep in pageLoadEvents array will be executed one by one.
Every time you call a load on $(window) it keep the content (e.g function(e) { .. }) you defined in load in an array and finally execute them each of them.