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