title: Auto-load/include for JavaScript
body: <p>I have file called <code>common.js</code> and it's included in each page of my site using <code>&lt;script /&gt;</code>.</p>
  
  <p>It will grow fast as my sites functionality will grow (I hope; I imagine). :)</p>
  
  <p>Lets example I have a jQuery event:</p>
  
  <pre><code>$('#that').click(function() {
  
      one_of_many_functions($(this));
  
  }
  </code></pre>
  
  <p>For the moment, I have that <code>one_of_many_functions()</code> in <code>common.js</code>.</p>
  
  <p>Is it somehow possible that JavaScript automatically loads file <code>one_of_many_functions.js</code> when such function is called, but it doesn't exist? Like auto-loader. :)</p>
  
  <p>The second option I see is to do something like:</p>
  
  <pre><code>$('#that').click(function() {
  
      include('one_of_many_functions');
  
      one_of_many_functions($(this));
  
  }
  </code></pre>
  
  <p>That not so automatically, but still - includes wanted file.</p>
  
  <p>Is any of this possible? Thanks in an advice! :)</p>