Is window.onload considered a global variable can I put it in my module pattern?
<p>I'm refactoring about 600 lines of javascript into the module pattern.  Here is a start from previous <a href="http://stackoverflow.com/questions/8158557/how-should-i-encapsulate-my-library">post</a>: 
I undertand the concept of anonymous methods...and sefl-executing....but not the scoping concepts...i.e. what global and window do.</p>

<pre><code>window.onload=initialize_page;

(function (global) {  
 global['test'] = 'test'; 

function initialize_page()
  {
  /* fill  here */
  }

})(window); 
</code></pre>

<p>Can I put window.onload=initialize_page into my module pattern?  Or does it need to be put outside of it?  Can someone explain how the access works?</p>

<p>EDIT 1: per Answer</p>

<pre><code>(function () {  

addEventListener('load', initialize_page);

function initialize_page()
  {
  alert ("hi");
  }

})(); 
</code></pre>
