pinafore/src/routes/_components/timeline/LazyTimeline.html

33 lines
893 B
HTML
Raw Normal View History

2018-01-19 00:51:51 -08:00
<div class="lazy-timeline">
2019-09-20 18:53:04 -07:00
{#if timelineComponent}
<svelte:component this={timelineComponent} {timeline} />
{/if}
2018-01-14 23:24:27 -08:00
</div>
<style>
2018-01-19 00:51:51 -08:00
.lazy-timeline {
2018-01-14 23:24:27 -08:00
width: 100%;
2018-01-19 00:51:51 -08:00
}
2018-01-14 23:24:27 -08:00
</style>
<script>
2018-01-28 13:09:39 -08:00
import { store } from '../../_store/store'
2019-09-20 18:53:04 -07:00
import { importTimeline } from '../../_utils/asyncModules'
2018-01-14 23:24:27 -08:00
export default {
2019-09-20 18:53:04 -07:00
async oncreate () {
console.log('LazyTimeline oncreate')
2019-08-03 13:49:37 -07:00
const { currentInstance } = this.store.get()
const { timeline } = this.get()
this.store.set({ currentTimeline: timeline })
this.store.setForTimeline(currentInstance, timeline, { runningUpdate: false })
2019-09-20 18:53:04 -07:00
console.log('importing timeline')
const timelineComponent = await importTimeline()
console.log('imported timeline')
this.set({ timelineComponent })
},
store: () => store,
2018-01-14 23:24:27 -08:00
data: () => ({
2019-09-20 18:53:04 -07:00
timelineComponent: undefined
2018-01-30 22:21:31 -08:00
})
2018-01-14 23:24:27 -08:00
}
</script>