Basic Svelte
Introduction
Bindings
Advanced Svelte
Advanced reactivity
Motion
Advanced bindings
Advanced transitions
Context API
Special elements
<script module>
Next steps
Basic SvelteKit
Introduction
Routing
Loading data
Headers and cookies
Shared modules
API routes
Stores
Errors and redirects
Advanced SvelteKit
Page options
Link options
Advanced routing
Advanced loading
Environment variables
Conclusion
The updated
store contains true
or false
depending on whether a new version of the app has been deployed since the page was first opened. For this to work, your svelte.config.js
must specify kit.version.pollInterval
.
src/routes/+layout
<script>
import { page, navigating, updated } from '$app/stores';
</script>
Version changes only happen in production, not during development. For that reason, $updated
will always be false
in this tutorial.
You can manually check for new versions, regardless of pollInterval
, by calling updated.check()
.
src/routes/+layout
{#if $updated}
<div class="toast">
<p>
A new version of the app is available
<button onclick={() => location.reload()}>
reload the page
</button>
</p>
</div>
{/if}
previous next
1
2
3
<h1>home</h1>
<p>this is the home page.</p>