UNPKG

@saleor/app-sdk

Version:
25 lines (22 loc) 517 B
// src/util/is-in-iframe.ts var isInIframe = () => { if (!document || !window) { throw new Error("isInIframe should be called only in browser"); } try { return document.location !== window.parent.location; } catch (e) { return false; } }; // src/util/use-is-mounted.ts import { useEffect, useState } from "react"; var useIsMounted = () => { const [mounted, setMounted] = useState(false); useEffect(() => setMounted(true), []); return mounted; }; export { isInIframe, useIsMounted };