overleaf/services/web/frontend/js/features/ide-react/hooks/use-register-user-activity.ts
Tim Down 1c820de200 Merge pull request #15610 from overleaf/td-ide-page-editor-events
React IDE page: hook up events

GitOrigin-RevId: 1121a30755fc600023f06925ca3eafa7a8e1ee14
2023-11-14 09:04:36 +00:00

10 lines
463 B
TypeScript

import { useConnectionContext } from '@/features/ide-react/context/connection-context'
import useEventListener from '@/shared/hooks/use-event-listener'
import useDomEventListener from '@/shared/hooks/use-dom-event-listener'
export function useRegisterUserActivity() {
const { registerUserActivity } = useConnectionContext()
useEventListener('cursor:editor:update', registerUserActivity)
useDomEventListener(document.body, 'click', registerUserActivity)
}