Is it possible to use `document.createEvent("KeyboardEvent")` in XD?

I’m trying to programatically reload the plugin that’s why I need to emulate key press.

var keyboardEvent = document.createEvent("KeyboardEvent");
var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent";

  "keydown", // event type: keydown, keyup, keypress
  true,      // bubbles
  true,      // cancelable
  window,    // view: should be window
  false,     // ctrlKey
  false,     // altKey
  false,     // shiftKey
  false,     // metaKey
  40,        // keyCode: unsigned long - the virtual key code, else 0
  0          // charCode: unsigned long - the Unicode character associated with the depressed key, else 0

createEvent method is not supported. Assuming this is related to the other post you just posted, hopefully we can resolve that issue so you won’t have to use this workaround

1 Like

Yes it is related to the issue in the other post. Thank you for the prompt reply and looking into it!