database-petani-mobile/node_modules/@base44/vite-plugin/dist/injections/sandbox-mount-observer.js
2026-02-23 16:39:35 +07:00

18 lines
864 B
JavaScript

if (window.self !== window.top) {
const observer = new MutationObserver((mutations) => {
const nodesAdded = mutations.some((mutation) => mutation.addedNodes.length > 0);
const nodesRemoved = mutations.some((mutation) => mutation.removedNodes.length > 0);
if (nodesAdded || nodesRemoved) {
const foundElmWithDataAttribute = document.body.querySelectorAll("[data-source-location], [data-dynamic-content]").length > 0;
if (foundElmWithDataAttribute) {
window.parent?.postMessage({ type: "sandbox:onMounted" }, "*");
}
else {
window.parent?.postMessage({ type: "sandbox:onUnmounted" }, "*");
}
}
});
observer.observe(document.body, { childList: true, subtree: true });
}
export {};
//# sourceMappingURL=sandbox-mount-observer.js.map