UNPKG

koval-ui

Version:

React components collection with minimalistic design. Supports theming, layout, and input validation.

24 lines (23 loc) 678 B
"use client"; import { useState as a, useEffect as s, useCallback as l } from "react"; import { PlayModes as i } from "./types.js"; const h = ({ embedRef: r, playMode: u }) => { const [t, e] = a(0); return s(() => { const c = setInterval(() => { r.current?.currentTime && u === i.play && r.current?.currentTime !== t && e(r.current?.currentTime); }, 1e3); return () => { clearInterval(c); }; }, [t, u, r]), { handleSetTime: l( (n) => { e(n.target.valueAsNumber), r.current.currentTime = n.target.valueAsNumber; }, [r] ), currentTime: t, setCurrentTime: e }; }; export { h as useTime }; //# sourceMappingURL=useTime.js.map