I’m building a small website using kotlin and kvision. I need to detect keyboard events, specifically for the arrow keys. I’ve been wrestling with this for a while and nothing I try will produce keypress or keydown events within kotlin for arrow key presses, although I do get keypress events for normal character keys.
Anyway, my workaround will be to hopefully just detect the arrow key events in HTML:
my root kotlin package is
foo is defined globally in nap.
Based on the docs I should use my module name before my root package. I can’t figure out for sure what my module name is, but I’m pretty sure this is right.
NAP_web is the name of my project folder and the generated js that I upload to the webpage is called
But I get the error:
Uncaught ReferenceError: NAP_web is not defined at HTMLBodyElement.onkeydown
Perhaps there’s a fix to get key events from arrow keys without needing html but being able to call kotlin-generated-js from html seems like a more general problem I should focus on fixing first. Do I have the wrong module name or is there something else I should try?