title: How to spy on jQuery events
body: <p>I want my tool to be able to spy on jQuery events(only jQuery is enough as all my projects uses it to bind events).</p>
  
  <p>I am not testing but writing tool which works based on triggered events.</p>
  
  <p>What I have found which suits my needs is <a href="https://github.com/velesin/jasmine-jquery#event-spies" rel="nofollow">jasmine-jquery</a> which is really nice and awesome but I do not want to include Jasmine or to use it. I would like it to be standalone or simple jQuery plugin.</p>
  
  <p>I would appreciate any input or direction.</p>
  
  <p><strong>What more have I tried?</strong></p>
  
  <p>I thought about writing my own <code>jQuery</code> plugin for it which would let me do things like:</p>
  
  <pre><code>var clicked = Events.click.haveBeenTriggeredOn('#some_element');
  var scrolled = Events.scroll.toHaveBeenTriggeredOn('#other_element')
  </code></pre>
  
  <p><strong>Even better yet</strong> - support callbacks. Now anyone can say - what's wrong with attaching one more handler to the element manually like:</p>
  
  <pre><code>$(selector).on('click', function() { yourBeautifulCallback() });
  </code></pre>
  
  <p>And what can I say - nothing. Except it's not elegant and requires manual labor all over the place and I <strong>fear of breaking things up</strong> in existing app.</p>