title: Function invoked event in JS?
body: <p>Is it possible to bind a function to another function on invoke?  So for example, it would go something like this:</p>
  
  <pre><code>function a(){...}
  function b(){...}
  b.bind("onInvoke","a");
  </code></pre>
  
  <p>So when b is called, a is also automatically called.</p>
  
  <hr>
  
  <p>EDIT:  OK OK, to clarify, this is not a question on chaining.  The idea is to find an elegant way to do event binding.  Observe the normal "non-elegant" way with normal function call-back:</p>
  
  <pre><code>function handler(){...}
  function caller1(){handler(); ...}
  function caller2(){handler(); ...}
  function caller2(){handler(); ...}
  // More callers all over your website everywhere else
  </code></pre>
  
  <p>That works right?  But what if I have caller all over the place?  It's hard to organize or change things.</p>
  
  <p>Now observe the superior solution!  (If one exist)</p>
  
  <pre><code>function handler(){...}
  // Caller make no reference to handler on creation
  function caller1(){...}
  function caller2(){...}
  function caller3(){...}
  // Caller function are still all over the place, all over your website
  // Event handler registered later in one location here, doesn't matter where they are phsically
  caller1.bind("onInvoke",handler);
  caller2.bind("onInvoke",handler);
  caller3.bind("onInvoke",handler);
  </code></pre>
  
  <p>So very much like your normal HTML - JQuery event registration.  You don't write onClick on every image the user might click on (which are all over the place), it would be way too troublesome to organize that!  You just write one simple</p>
  
  <pre><code> $("img").bind("onClick",click_handler);
  </code></pre>
  
  <p>for your entire site.  This is the jist of what I am looking for, except for JS functions.</p>
  
  <p>I hope that clarify things.</p>
  
  <hr>
  
  <p>EDIT 2:  Need to work with IE7!!!  JavaScript 1.8.5 is great and everything, but nothing support it right now.</p>