|
|
|
@ -1,10 +1,11 @@
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
|
import { navigateTo } from '#app' |
|
|
|
|
import { navigateTo, useEventListener, useRouter } from '#imports' |
|
|
|
|
const { isLoading, currentVersion } = useGlobal() |
|
|
|
|
const { sharedView } = useSharedView() |
|
|
|
|
const router = useRouter() |
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
// check if we are inside an iframe |
|
|
|
|
if (window.parent !== window) { |
|
|
|
|
const notifyLocationChange = (value: string) => |
|
|
|
|
window.parent.postMessage( |
|
|
|
@ -16,11 +17,12 @@ if (window.parent !== window) {
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
router.afterEach((to) => notifyLocationChange(location.origin + to.fullPath)) |
|
|
|
|
window.addEventListener('beforeunload', () => { |
|
|
|
|
useEventListener(window, 'beforeunload', () => { |
|
|
|
|
const { href } = document.activeElement as { href?: string } |
|
|
|
|
if (href) notifyLocationChange(href) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
|
|