Remove onWindowBlur

we already do this in usePTT
This commit is contained in:
David Baker 2022-05-04 17:35:43 +01:00
parent f0b116714b
commit 85a98b3706

View file

@ -16,12 +16,7 @@ export function PTTButton({
}) {
const [isHeld, setHeld] = useState(false);
const onDocumentMouseUp = useCallback(() => {
if (isHeld) stopTalking();
setHeld(false);
}, [isHeld, setHeld]);
const onWindowBlur = useCallback(() => {
if (isHeld) stopTalking();
//if (isHeld) stopTalking();
setHeld(false);
}, [isHeld, setHeld]);
@ -32,13 +27,11 @@ export function PTTButton({
useEffect(() => {
window.addEventListener("mouseup", onDocumentMouseUp);
window.addEventListener("blur", onWindowBlur);
return () => {
window.removeEventListener("mouseup", onDocumentMouseUp);
window.removeEventListener("blur", onWindowBlur);
};
}, [onDocumentMouseUp, onWindowBlur]);
}, [onDocumentMouseUp]);
return (
<button