UNPKG

core-outline

Version:

A React component for Core&Outline

27 lines (21 loc) 461 B
import { useEffect, useRef } from 'react'; import { record } from 'rrweb'; const useRRWebRecorder = () => { const eventsRef = useRef([]); useEffect(() => { const stopRecording = record({ emit(event) { if (event) { eventsRef.current.push(event); } }, }); return () => { if (stopRecording) { stopRecording(); } }; }, []); return eventsRef; }; export default useRRWebRecorder;