topical media & game development
mobile-query-three-plugins-whammy-tquery.whammy.bindkeyboard.js / js
tQuery.Whammy.registerInstance('bindKeyboard', function(keyCode, element){
// handle parameters polymorphism
element = element || document.body;
keyCode = keyCode !== undefined ? keyCode : "r".charCodeAt(0);
// bind event
element.addEventListener('keypress', function(event){
// if not our action key
if( event.keyCode !== keyCode ) return;
// press switch
this.pressSwitch(element);
}.bind(this));
return this; // for chained API
});
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.