Skip to content

Commit

Permalink
_
Browse files Browse the repository at this point in the history
  • Loading branch information
try0 committed Jul 18, 2023
1 parent 4fa1991 commit 5a004a1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spa-example/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
import Icon from 'svelte-awesome';
import github from 'svelte-awesome/icons/github';
import { goto } from '$app/navigation';
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
onMount(() => {
window.addEventListener('beforeunload', (e: BeforeUnloadEvent) => {
e.preventDefault();
e.returnValue = null;
goto(window.location.href);
dispatch('push', window.location.pathname);
return false;
});
});
Expand Down

0 comments on commit 5a004a1

Please sign in to comment.