mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
18 lines
334 B
TypeScript
18 lines
334 B
TypeScript
|
import { useState, useEffect } from "react";
|
||
|
|
||
|
const useIsInIframe = () => {
|
||
|
const [isInIframe, setIsInIframe] = useState(false);
|
||
|
|
||
|
useEffect(() => {
|
||
|
const checkIfInIframe = () => {
|
||
|
setIsInIframe(window.self !== window.top);
|
||
|
};
|
||
|
|
||
|
checkIfInIframe();
|
||
|
}, []);
|
||
|
|
||
|
return isInIframe;
|
||
|
};
|
||
|
|
||
|
export default useIsInIframe;
|