pinafore/src/routes/_components/timeline/LazyTimeline.html
2019-09-20 18:53:04 -07:00

32 lines
893 B
HTML

<div class="lazy-timeline">
{#if timelineComponent}
<svelte:component this={timelineComponent} {timeline} />
{/if}
</div>
<style>
.lazy-timeline {
width: 100%;
}
</style>
<script>
import { store } from '../../_store/store'
import { importTimeline } from '../../_utils/asyncModules'
export default {
async oncreate () {
console.log('LazyTimeline oncreate')
const { currentInstance } = this.store.get()
const { timeline } = this.get()
this.store.set({ currentTimeline: timeline })
this.store.setForTimeline(currentInstance, timeline, { runningUpdate: false })
console.log('importing timeline')
const timelineComponent = await importTimeline()
console.log('imported timeline')
this.set({ timelineComponent })
},
store: () => store,
data: () => ({
timelineComponent: undefined
})
}
</script>