JSFiddle - React, Tailwind, and code Playground

by johanthuresson

JavaScript

var map = [];

window.onkeydown = window.onkeyup = function(e){
    e = e || event; // to deal with IE
    map[e.keyCode] = e.type == 'keydown';

    if(e.altKey==true){ // ALT down
    if (map[39]) { //  + Right
        //window.history.forward();
        console.log("forward");
    }
    else if (map[37]) { //  + Left
        window.history.back();
        //console.log("back");
    }
    }


    else if (map[39]) { // Right Key
        window.location.href = "{{ path('sctn_findsong') }}";
    }
    if (map[38]){ // Up Key
        //
    }
    if (map[40]){ // Down Key
        //
    }
}