This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Neel Bhanushali <[email protected]> | |
document.addEventListener('keydown', function(e) { | |
// add scan property to window if it does not exist | |
if(!window.hasOwnProperty('scan')) { | |
window.scan = [] | |
} | |
// if key stroke appears after 10 ms, empty scan array | |
if(window.scan.length > 0 && (e.timeStamp - window.scan.slice(-1)[0].timeStamp) > 10) { | |
window.scan = [] |