JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://d3js.org/d3.v4.js"></script>
<svg>
  <circle cx="120" cy="80" r="50" fill="teal"></circle>
</svg>

JavaScript

var circle = d3.select("circle");

circle.on("mousemove", debounce(function() {
  console.log(this);
}, 250));

function debounce(fn, delay) {
  var timer = null;
  return function() {
    var context = this,
      args = arguments;
    clearTimeout(timer);
    timer = setTimeout(function() {
      fn.apply(context, args);
    }, delay);
  };
}