JSFiddle - React, Tailwind, and code Playground

HTML

<div id="console"></div>

JavaScript

// limit a function to only firing once every XX ms
var throttle = (function (){
  return function (fn, delay){
    var last = 0, timeout, args;
    delay || (delay = 100);
    return function throttle() {
            // we subtract the delay to prevent double executions
      var now = +new Date, elapsed = (now - last - delay);
            args=arguments;
            
            function exec(){
                // remove any existing delayed execution
                timeout && (timeout = clearTimeout(timeout));
        fn.apply(this, args);
        last = now;
            }
            
            // execute the function now
      if( elapsed > delay ) exec();
            // add delayed execution (this could execute a few ms later than the delay)
            else if( !timeout ) timeout = setTimeout(exec, delay);
    };
  };
})();


$(window).mousemove(throttle(function (e) {
    $("#console").prepend("<div>" + e.pageX + " " + e.pageY + "</div>");
}, 1000));