1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-08 08:24:19 +01:00
Pinafore-Web-Client-Frontend/routes/_components/LazyPage.html
greenkeeper[bot] 8dbc1b0503 Update standard to the latest version 🚀 (#519)
* chore(package): update standard to version 12.0.0

* package lock update

* fix eslint
2018-08-29 21:42:57 -07:00

26 lines
723 B
HTML

{#if revealed}
<svelte:component this={pageComponent} {params} />
{/if}
<script>
// On the very first page load, avoid doing a "reveal" because
// it leads to a flash between when the SSR is shown, the two frame we hide it,
// and then when we show it again.
//
// We only really need LazyPage behavior when the user is clicking around
// after the page has loaded, to improve input responsiveness.
let firstTime = true
export default {
oncreate () {
firstTime = false
requestAnimationFrame(() => {
requestAnimationFrame(() => {
this.set({ revealed: true })
})
})
},
data: () => ({
revealed: !process.browser || firstTime
})
}
</script>