mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 21:34:53 -05:00
1c820de200
React IDE page: hook up events GitOrigin-RevId: 1121a30755fc600023f06925ca3eafa7a8e1ee14
12 lines
455 B
TypeScript
12 lines
455 B
TypeScript
import useEventListener from '@/shared/hooks/use-event-listener'
|
|
import { useLocalCompileContext } from '@/shared/context/local-compile-context'
|
|
|
|
export function useHasLintingError() {
|
|
const { setHasLintingError } = useLocalCompileContext()
|
|
|
|
// Listen for editor:lint event from CM6 linter and keep compile context
|
|
// up to date
|
|
useEventListener('editor:lint', (event: CustomEvent) => {
|
|
setHasLintingError(event.detail.hasLintingError)
|
|
})
|
|
}
|