title: Trigger Event when key is pressed and some other condition is true at the same time
body: <p>In a non-event-based language this task is done like this.</p>
  
  <pre><code>if (keypressed() and other_condition) {
    doSomething();
  }
  </code></pre>
  
  <p>I can hardy imagine how to reach the same goal when I dont have conditions but rather eventlisteners.</p>
  
  <pre><code>  $(document).on("keypress", function (a) {
      ....
    });
  
   $(document).on("othercondition", function (a) {
      ....
    });
  </code></pre>
  
  <hr>
  
  <p>To be less general:
  I call a function <code>report</code>. Within the function body, I want to perform a test, whether a key is currently pressed. This function within shall not be declared newly everytime I invoke the report-function.</p>
  
  <pre><code>  var report = function(e) {
  
         if (keypressed()) {
         }
    }
  </code></pre>