Konami Code

Every webpage should have something special happen when the user inputs the famous Konami code. What's the best way to implement this using JS? This is the first thing that occurred to me. I am 100% sure that there are better ways.

HTML

<img src=https://upload.wikimedia.org/wikipedia/en/9/99/Itispat.jpg></img>

JavaScript

// Implement the Konami Code on a webpage
//
// This is the first way that it occurred to me to do it. I am 100% sure there are other
// interesting and undoubtedly better ways. Show me how you would do it.

(function($) {
    
    var resetProgress,
        cheatProgress = 0,
        // An array of the keycodes for the code
        code = [
            // up up down down left right left right b a
            38, 38, 40, 40, 37, 39, 37, 39, 66, 65
        ],
        // How much time to allow between keypresses
        time = 500;
    
    $( document ).bind( 'keydown.konami', function( event ) {
        
        if ( event.keyCode === code[ cheatProgress ] ) {
            clearTimeout( resetProgress );
            
            if ( cheatProgress === code.length - 1 ) {
                
                $( document ).trigger( 'cheat.konami' );
                
                cheatProgress = 0;
                
            } else {
                
                resetProgress = setTimeout( function() {
                    console.log( 'Progress reset.' );
                    cheatProgress = 0;
                }, time );
                
                cheatProgress += 1;
            }
            
            console.log( event.keyCode );
        }
    });
    
    $( document ).bind( 'cheat.konami', function() {
     
        $( 'body' ).css({
            'background-color': 'hsl( 0, 50%, 50% )'
        })
            .children( 'h1' )
            .text( '30 LIVES' );
        
    });
    
})( jQuery );