hongluan-ui
Version:
Hongluan Component Library for Vue 3
32 lines (27 loc) • 725 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
require('./browser.js');
var core = require('@vueuse/core');
const rAF = (fn) => core.isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
const cAF = (handle) => core.isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
const throttleByRaf = (cb) => {
let timer = 0;
const throttle = (...args) => {
if (timer) {
cAF(timer);
}
timer = rAF(() => {
cb(...args);
timer = 0;
});
};
throttle.cancel = () => {
cAF(timer);
timer = 0;
};
return throttle;
};
exports.cAF = cAF;
exports.rAF = rAF;
exports.throttleByRaf = throttleByRaf;
//# sourceMappingURL=raf.js.map