Route Soma carousel autoplay through timers

active-uix
dev 5 months ago
parent 9a43cce697
commit 248152263c

@ -86,11 +86,20 @@ export class CarouselProvider {
if (!opts.autoplay.current) return; if (!opts.autoplay.current) return;
if (this.isDisabled) return; if (this.isDisabled) return;
if (this.paused) return; if (this.paused) return;
const id = setInterval(() => this.next(), opts.autoplayDelay.current); const handle = this.soma.uix.timers.interval(
return () => clearInterval(id); this.autoplayTimerKey,
opts.autoplayDelay.current,
() => this.next(),
{ replace: true, meta: { component: 'carousel', action: 'autoplay' } }
);
return () => handle.cancel();
}); });
} }
private get autoplayTimerKey() {
return `soma:carousel:${this.opts.id.current}:autoplay`;
}
// ── Slide detection (live DOM query) ──────────────────────────────────── // ── Slide detection (live DOM query) ────────────────────────────────────
getItems(): HTMLElement[] { getItems(): HTMLElement[] {

Loading…
Cancel
Save

Powered by TurnKey Linux.