2048.js
// Add key event for global object.
Add key event for global object.
Add key event for global object .
function registerEvent(callback) {
        function keyEventHandler(event) {
            var code = event.keyCode;
            callback.call(this, code);
        }
        window.addEventListener('keydown', keyEventHandler);
        return keyEventHandler;
    }
function registerEvent ( callback ) { function keyEventHandler ( event ) { var code = event . keyCode ; callback . call ( this , code ) ; } window . addEventListener ( 'keydown' , keyEventHandler ) ; return keyEventHandler ; }
Add key event for global object.
Add key event for global object .