Uncaught ReferenceError: $st is not defined at common.js:263 using chrome?

Uncaught ReferenceError: $st is not defined at common.js:263 using chrome?
0

#1

Does anybody encountered this: Uncaught ReferenceError: $st is not defined at common.js:263 problem using chrome? how to solve this?


#2

Need quite a bit more information than just that you are getting a JS error in Chrome. We have no idea what you’re trying to do.


#3

I’m experimenting with vanilla js and just trying to code a drum-machine, here’s my code, it’s not working and the console shows refference error $st is not defined at common.js:263:

HTML

<div id="music-maker">
        <section id="drumkit" class="sec">
            <div data-key="81" class="key">
                <span class="letter">q</span>
                <span class="audioname">kick</span>
            </div>
            <div data-key="87" class="key">
                <span class="letter">w</span>
                <span class="audioname">snare</span>
            </div>
            <div data-key="69" class="key">
                <span class="letter">e</span>
                <span class="audioname">hi-hat 1</span>
            </div>
            <div data-key="65" class="key">
                <span class="letter">a</span>
                <span class="audioname">hi-hat 2</span>
            </div>
            <div data-key="83" class="key">
                <span class="letter">s</span>
                <span class="audioname">tom-tom</span>
            </div>
            <div data-key="68" class="key">
                <span class="letter">d</span>
                <span class="audioname">crash</span>
            </div>
            <div data-key="90" class="key">
                <span class="letter">z</span>
                <span class="audioname">ride</span>
            </div>
            <div data-key="88" class="key">
                <span class="letter">x</span>
                <span class="audioname">china</span>
            </div>
            <div data-key="67" class="key">
                <span class="letter">c</span>
                <span class="audioname">cowbell</span>
            </div>
        </section>
        <section id="synth" class="sec">
            <div data-key="85" class="key">
                <span class="letter">u</span>
                <span class="audioname">horn</span>
            </div>
            <div data-key="73" class="key">
                <span class="letter">i</span>
                <span class="audioname">kick</span>
            </div>
            <div data-key="79" class="key">
                <span class="letter">o</span>
                <span class="audioname">kick</span>
            </div>
            <div data-key="72" class="key">
                <span class="letter">h</span>
                <span class="audioname">kick</span>
            </div>
            <div data-key="74" class="key">
                <span class="letter">j</span>
                <span class="audioname">kick</span>
            </div>
            <div data-key="75" class="key">
                <span class="letter">k</span>
                <span class="audioname">kick</span>
            </div>
            <div data-key="66" class="key">
                <span class="letter">b</span>
                <span class="audioname">kick</span>
            </div>
            <div data-key="78" class="key">
                <span class="letter">n</span>
                <span class="audioname">kick</span>
            </div>
            <div data-key="77" class="key">
                <span class="letter">m</span>
                <span class="audioname">kick</span>
            </div>
        </section>
        <!-- Drumkit keys Audio -->
        <audio data-key="81" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532587165/fcc-drum-machine/kick-drums/kick-drum-7.mp3" class="audiofile"></audio>
        <audio data-key="87" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532587362/fcc-drum-machine/snare-drums/snaredrum1.mp3" class="audiofile"></audio>
        <audio data-key="69" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532587997/fcc-drum-machine/hi-hats/hihat1.mp3" class="audiofile"></audio>
        <audio data-key="65" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532587997/fcc-drum-machine/hi-hats/hihat4.mp3" class="audiofile"></audio>
        <audio data-key="83" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532588185/fcc-drum-machine/tom-toms/tomtomdrum3.mp3" class="audiofile"></audio>
        <audio data-key="68" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532587948/fcc-drum-machine/cymbals%202/cymbalcrash1.mp3" class="audiofile"></audio>
        <audio data-key="90" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532582454/sample-swap/drums-and-single-hits/rides/RIDE_S_11.mp3" class="audiofile"></audio>
        <audio data-key="88" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532580120/sample-swap/drums-and-single-hits/china/big_china_cym.mp3" class="audiofile"></audio>
        <audio data-key="67" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532587867/fcc-drum-machine/cowbells/cowbell1.mp3" class="audiofile"></audio>
        <!-- Synthkit keys Audio -->
        <audio data-key="81" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532674689/sample-swap/horn/horn-section-godown.mp3" class="audiofile"></audio>
        <audio data-key="87" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532674456/sample-swap/flute/192_flute-madness.mp3" class="audiofile"></audio>
        <audio data-key="69" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532674666/sample-swap/piano/almost-the-doors-organ.mp3" class="audiofile"></audio>
        <audio data-key="65" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532675116/sample-swap/sax/sax-squeal-tore-my-brains-out.mp3" class="audiofile"></audio>
        <audio data-key="83" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532674083/sample-swap/guitar/120_acoustic-guitar-picking1.mp3" class="audiofile"></audio>
        <audio data-key="68" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532674667/sample-swap/piano/096_salsa-piano-1.mp3" class="audiofile"></audio>
        <audio data-key="90" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532674483/sample-swap/violin/violin-loop-2.mp3" class="audiofile"></audio>
        <audio data-key="88" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532674510/sample-swap/choir/Slavic-Choir_Eb_Aah.mp3" class="audiofile"></audio>
        <audio data-key="67" src="https://res.cloudinary.com/dzsmdyknz/video/upload/v1532674533/sample-swap/voice/voice_woo.mp3" class="audiofile"></audio>
    </div>

JS

window.addEventListener('keydown',function(e){
    console.log(e);
    const audio = document.querySelector(`audio[data-key='${e.keyCode}']`)
    if(!audio) return;  // stop the function from running all together; it will return null
    audio.currentTime = 0; // rewind the audio from the begining so it plays it everytime the key is press
    audio.play();
});