I have a Class for simple Input-Handling like this:
class Key
{
static enter(event, handler)
{
if (event.keyCode === 13) {
$handler();
}
}
}
and it is called like <div onkeydown="Key.enter(event, customFunction)"></div>
I would like to be able to get the event inside of Key.enter() without always passing it to the function. I know that in a normal Function this.event
would work, but this does not work, probably because Im inside a class.
Any ideas how to still get the Event that called the function so that I can call it like Key.enter(customFunction)
?
Update: Made Function static, It already was in my Code, but forgot to write it in the Question.