This is the fourth part of the javascript game development tutorial for beginners, where we implement the input class, which is an abstraction from the dom events.
In the video we handle only the press event though, but it could easily be extended to handle more events types.