title: creating a jQuery Event Listener for when custom function is called
body: <p>I have a function, let call it: myFunction, that I use a lot.  Most of the time, I don't care when it's called.  However, sometimes, it would be nice to know when it is called so that I can perform certain actions.  Is there a way that I can, without editing myFunction, create a listener in jQuery so that when myFunction is done, I can call another function?</p>
  
  <p>for example: </p>
  
  <pre><code>&lt;script&gt;
  var foo = "foo";
  function myFunction() {
      foo += "bar";
  }
  function afterMyFunction() {
      alert(foo);
  }
  
  $(function() {
      #some sort of listener for when myFunction is done --- ???#
  
      myFunction();
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I would want, when the page loads, for there to be an alert that simply says "foobar".  This is obviously a simplified example, but it gets my point across... I hope.</p>