title: Get a List of currently pressed keys, whitout keyup/keydown
body: <p>I had a curious problem today: A script, that always worked before, stopped to work because apparently 'keyup' was fired directly after every 'keydown' event, killing some events that waited for long keypresses.</p>
  
  <p>After testing around, I found out that my synergy was responsible for that.</p>
  
  <p>Finally, I found a solution to the problem: A jQuery extension that allowed me to delay (and collect) certain events, namely <a href="http://benalman.com/projects/jquery-throttle-debounce-plugin/" rel="nofollow">http://benalman.com/projects/jquery-throttle-debounce-plugin/</a></p>
  
  <pre><code>$(window).keyup( $.debounce(100, onKeyUp) )
  </code></pre>
  
  <p>This worked for a bit, until I noticed another problem: Multiple keys at once. Let's say, you press the 'up' button, and the 'left' button - and then let go of both at the same time. the $.debounce() will handle both as the same keyup event, letting the event only fire once and causing <code>event.keyCode</code> to only contain one key instead of both.</p>
  
  <p>The simplest solution would be, to check all the keys pressed when the keyup event is fired, not relying on <code>event.keyCode</code> since it's incomplete in this case.</p>
  
  <p>My problem is: how can I find out what other keys are still pressed, <strong>whitout relying on keydown / keyup events?</strong> (since they wont work, because of synergy)</p>
  
  <pre><code>function onKeyUp(event) {
      // get all keys pressed
  }
  </code></pre>
  
  <p>Is there some kind of <code>window</code> variable keeping track of the keys?</p>
  
  <p>Any ideas?</p>