const raf = window.requestAnimationFrame || setTimeout;
export default function (fn) {
  var called = false;

  return function (...args) {
    if (!called) {
      called = true;
      raf(() => {
        called = false;
        fn.apply(this, args);
      });
    }
  };
}

export default function (fn) {
  let called = false;
  return function (...args) {
    if (!called) {
      called = true;
      setTimeout(() => {
        called = false;
        fn.apply(this, args);
      });
    }
  };
}

Fix debounce to use setTimeout(fn, 0) only as there are issues with requestAnimatio