UNPKG

koval-ui

Version:

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

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