2018-05-02 02:05:36 +02:00
|
|
|
{#if revealed}
|
|
|
|
<svelte:component this={pageComponent} {params} />
|
|
|
|
{/if}
|
2018-03-14 01:14:57 +01:00
|
|
|
<script>
|
2018-04-14 23:50:53 +02:00
|
|
|
// 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
|
|
|
|
|
2018-03-14 01:14:57 +01:00
|
|
|
export default {
|
2018-04-20 06:38:01 +02:00
|
|
|
oncreate () {
|
2018-04-14 23:50:53 +02:00
|
|
|
firstTime = false
|
2018-03-28 04:46:01 +02:00
|
|
|
requestAnimationFrame(() => {
|
|
|
|
requestAnimationFrame(() => {
|
2018-08-30 06:42:57 +02:00
|
|
|
this.set({ revealed: true })
|
2018-03-28 04:46:01 +02:00
|
|
|
})
|
|
|
|
})
|
2018-03-14 01:14:57 +01:00
|
|
|
},
|
|
|
|
data: () => ({
|
2018-04-14 23:50:53 +02:00
|
|
|
revealed: !process.browser || firstTime
|
2018-03-14 01:14:57 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
</script>
|