Using Keypress with RequireJS
I’m not going to go into the reasons why I choose Keypress right now. Suffice it to say, given its original focus on input for games, it makes a great choice for control applications in general.
The author was kind enough to provide AMD support. However, the documentation isn’t completely clear about using Keypress as an AMD module. The documentation states that a listener can be instantiated like so:
var listener = new window.keypress.Listener();
However, if you’re using Keypress and an AMD module, the object is made available as ‘keypress’ as opposed to ‘window.keypress’. So, in this case, the listener should be exposed like so:
var listener = new keypress.Listener();
Hopefully, this will save somene out there some time.