title: Javascript disabling a keyevent and enabling it back
body: <p>I'm quite curious for keyup and keydown function.</p>
  
  <p>I wanted to disable the keys for like 2 seconds then enabling back them.
  I've set a function <code>setTimeout</code> to ensure to enable it back under this function <code>continueExecution</code>.</p>
  
  <p>The issue is , i'm trying to figure out how to disable it.
  I've tried <br> <code>e.preventDefault();</code>
  <br>
  Tried sending false back still no luck.</p>
  
  <p>Is there something I'm missing?</p>
  
  <p>Event handler:</p>
  
  <pre><code>var keysDown = {},
  ignore = false,tId;
  
  addEventListener("keydown", function(e) {
    if (ignore) return false;
    keysDown[e.keyCode] = true;
  }, false);
  
  addEventListener("keyup", function(e) {
    if (ignore) return false;
    delete keysDown[e.keyCode];
  }, false);
  </code></pre>
  
  <p>Function:</p>
  
  <pre><code>function doStuff() {
    hero.y = 0;   
    ignore=true;
    tId = setTimeout(function() { ignore=false; continueExecution() }, 2000) //wait two seconds before continuing
  
  }
  
  
  
  function continueExecution()
  {   
  
      hero.y = -281;
  }
  </code></pre>