whole_func_string: function simulateKeyboardEvent(type, key) {
      var codes = {
          left: 37,
          up: 38,
          right: 39,
          down: 40,
          w: 87,
          a: 65,
          s: 83,
          d: 68,
          enter: 13,
          escape: 27,
          space: 32,
          control: 17,
          z: 90,
          x: 88
      };
  
      var event = new KeyboardEvent(type); // allowed: keydown, keyup
  
      Object.defineProperty(event, 'keyCode', {
          get: function () {
              return codes[key];
          }
      });
  
      document.dispatchEvent(event);
  }
func_code_string: function simulateKeyboardEvent(type, key) {
      var codes = {
          left: 37,
          up: 38,
          right: 39,
          down: 40,
          w: 87,
          a: 65,
          s: 83,
          d: 68,
          enter: 13,
          escape: 27,
          space: 32,
          control: 17,
          z: 90,
          x: 88
      };
  
      var event = new KeyboardEvent(type); // allowed: keydown, keyup
  
      Object.defineProperty(event, 'keyCode', {
          get: function () {
              return codes[key];
          }
      });
  
      document.dispatchEvent(event);
  }
func_documentation_string: /* HELPER METHODS