overleaf/services/web/frontend/js/shared/hooks/user-channel/use-broadcast-user.ts

13 lines
333 B
TypeScript
Raw Normal View History

import { useEffect } from 'react'
import { useUserContext } from '@/shared/context/user-context'
import { useUserChannel } from './use-user-channel'
export const useBroadcastUser = () => {
const user = useUserContext()
const channel = useUserChannel()
useEffect(() => {
channel?.postMessage(user)
}, [channel, user])
}