title: jQuery trigger before listener
body: <p>With <code>$(document).ready();</code>  you can execute it AFTER dom is ready but it will still fire.</p>
  
  <p>How can I get a custom trigger to behave in the same way?</p>
  
  <p>i.e. </p>
  
  <pre><code>$(document).trigger("myEvent");
  </code></pre>
  
  <p>As the page is loading (before myEvent), I might lazy load a script, do some Ajax, and when Ajax is complete (now possibly after myEvent), I'd place a listener in the Ajax callback to make sure myEvent as happened before I proceed (like you might do with a $(document).ready())</p>
  
  <pre><code>$(document).on("myEvent", function(){ ... });
  </code></pre>
  
  <p>But obviously this won't fire because it was triggered before the listener was in place. </p>