mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-27 02:51:18 -04:00
* Test * Add pretty formatting * Fix Tests * Fix Tests * Fix Tests * Fix * Add pretty formatting fix * Fix * Test * Fix tests * Clean typeckech * Add prettier check * Fix api tsconfig * Fix api tsconfig * Fix tsconfig * Fix * Fix * Prettier
16 lines
323 B
TypeScript
16 lines
323 B
TypeScript
import {useEffect, useState} from 'react'
|
|
|
|
export function inIframe() {
|
|
try {
|
|
return window.self !== window.top
|
|
} catch (e) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
export function useIsIframe() {
|
|
const [is, setIs] = useState(false)
|
|
useEffect(() => setIs(inIframe()), []) // useEffect so this happens client side
|
|
return is
|
|
}
|