mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #19070 from overleaf/dp-remove-useWaitForGrammarlyCheck
Remove grammarly check in writefull promo GitOrigin-RevId: 30994c1960232afe3bede1fd6649606e191dd3d4
This commit is contained in:
parent
c70e676cbc
commit
8d2b006d60
1 changed files with 0 additions and 29 deletions
|
@ -1,29 +0,0 @@
|
|||
import { useEffect, useState } from 'react'
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} delay how long to wait before checking for grammarly in ms
|
||||
* @param {boolean} initialState the initial state we should set grammarlyInstalled to before checking after the delay
|
||||
* @returns {boolean} a stateful boolean which is initially false, then updates to reflect whether grammarly is installed after the delay to check
|
||||
*/
|
||||
export default function useWaitForGrammarlyCheck({
|
||||
delay = 3000,
|
||||
initialState = false,
|
||||
}) {
|
||||
const [grammarlyInstalled, setGrammarlyInstalled] = useState(() => {
|
||||
return initialState
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(
|
||||
() => setGrammarlyInstalled(grammarlyExtensionPresent()),
|
||||
delay
|
||||
)
|
||||
return () => clearTimeout(timer)
|
||||
}, [delay])
|
||||
return grammarlyInstalled
|
||||
}
|
||||
|
||||
function grammarlyExtensionPresent() {
|
||||
return !!document.querySelector('grammarly-desktop-integration')
|
||||
}
|
Loading…
Reference in a new issue