Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
20 lines
577 B
Plaintext
20 lines
577 B
Plaintext
"use client";
|
|
import { useState, useEffect } from 'react';
|
|
|
|
function usePageInView() {
|
|
const [isInView, setIsInView] = useState(true);
|
|
useEffect(() => {
|
|
const handleVisibilityChange = () => setIsInView(!document.hidden);
|
|
if (document.hidden) {
|
|
handleVisibilityChange();
|
|
}
|
|
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
return () => {
|
|
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
};
|
|
}, []);
|
|
return isInView;
|
|
}
|
|
|
|
export { usePageInView };
|