@blinkk/selective-edit
Version:
Selective structured text editor.
23 lines • 632 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Throttle = void 0;
/**
* Throttle events using the requestAnimationFrame.
*/
class Throttle {
constructor(type, name) {
this.running = false;
window.addEventListener(type, () => {
if (this.running) {
return;
}
this.running = true;
requestAnimationFrame(() => {
window.dispatchEvent(new CustomEvent(name));
this.running = false;
});
});
}
}
exports.Throttle = Throttle;
//# sourceMappingURL=throttle.js.map