'use strict';

var raf = require('./vue/raf.cjs');

function throttleByAnimationFrame(fn) {
  let requestId;
  const later = (args) => () => {
    requestId = null;
    fn(...args);
  };
  const throttled = (...args) => {
    if (requestId == null)
      requestId = raf.raf(later(args));
  };
  throttled.cancel = () => {
    raf.raf.cancel(requestId);
    requestId = null;
  };
  return throttled;
}

exports.throttleByAnimationFrame = throttleByAnimationFrame;
//# sourceMappingURL=throttleByAnimationFrame.cjs.map
