UNPKG

@gecut/mixins

Version:

A tiny, TypeScript-powered package of hyper-fast LitElement mixins. Enhance your web components with swift, type-safe functionality that’s easy to integrate.

25 lines 971 B
import { cancelNextAnimationFrame, nextAnimationFrame } from '@gecut/utilities/wait/polyfill.js'; export function ScheduleUpdateToFrameMixin(superClass) { class ScheduleUpdateToFrameMixinClass extends superClass { constructor() { super(...arguments); Object.defineProperty(this, "scheduleUpdateDebounce", { enumerable: true, configurable: true, writable: true, value: void 0 }); } async scheduleUpdate() { if (this.scheduleUpdateDebounce != null) { cancelNextAnimationFrame(this.scheduleUpdateDebounce); } await new Promise((resolve) => { this.scheduleUpdateDebounce = nextAnimationFrame(resolve.bind(this)); }); super.scheduleUpdate(); } } return ScheduleUpdateToFrameMixinClass; } //# sourceMappingURL=schedule-update-to-frame.js.map