UNPKG

balm-ui

Version:

A modular and customizable UI library based on Material Design and Vue 3

20 lines (14 loc) 349 B
function throttle(type, name, obj) { obj = obj || window; let running = false; const func = function () { if (running) return; running = true; requestAnimationFrame(function () { obj.dispatchEvent(new CustomEvent(name)); running = false; }); }; obj.addEventListener(type, func); } export default throttle;