UNPKG

@pdf-viewer/react

Version:

A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.

18 lines (17 loc) 370 B
import { useRef as i, useCallback as o } from "react"; const u = (r, c, e = !1) => { const t = i(-1), n = o( (...s) => { a(), t.current = requestAnimationFrame(() => { r(...s), e && n(...s); }); }, [...c, e] ), a = o(() => { cancelAnimationFrame(t.current); }, []); return { start: n, stop: a }; }; export { u as default };