title: jQuery or plain JS: execute function after event listener returns
body: <p>Let's say I have an event named "<code>bar</code>" on element <code>#foo</code>.</p>
  
  <p>Is there a way I can use jQuery deferred objects to force a function to execute immediately after the <code>bar</code> event listener(s) has/have executed (returned), whether or not any <code>bar</code> listeners cancel the event?</p>
  
  <p>Or maybe I don't even need jQuery for this?</p>
  
  <p>EDIT: Just to clarify, triggering another event or function from within the <code>bar</code> handler is not what I'm looking for&mdash;the <code>bar</code> handler hasn't returned yet, so that's not "after that <code>bar</code> event." This question may seem odd and not make sense because I'm trying to address a very specific issue/bug in IE 8. </p>
  
  <p>Something like this is needed:</p>
  
  <pre><code>$('#foo').afterEvent('bar').then(function() {
      // do something
  });
  </code></pre>