forked from cybrespace/pinafore
37 lines
1.0 KiB
HTML
37 lines
1.0 KiB
HTML
<div class="lazy-timeline">
|
|
{{#await importTimeline}}
|
|
{{then constructor}}
|
|
<:Component {constructor} :timeline />
|
|
{{catch error}}
|
|
<div>Component failed to load. Try refreshing! {{error}}</div>
|
|
{{/await}}
|
|
</div>
|
|
<style>
|
|
.lazy-timeline {
|
|
width: 100%;
|
|
min-height: 60vh;
|
|
}
|
|
</style>
|
|
<script>
|
|
import { importTimeline } from '../../_utils/asyncModules'
|
|
import { store } from '../../_store/store'
|
|
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
|
|
|
export default {
|
|
oncreate() {
|
|
let instanceName = this.store.get('currentInstance')
|
|
let timeline = this.get('timeline')
|
|
this.store.set({currentTimeline: timeline})
|
|
this.store.setForTimeline(instanceName, timeline, {runningUpdate: false})
|
|
},
|
|
store: () => store,
|
|
data: () => ({
|
|
importTimeline: importTimeline().then(timeline => {
|
|
return new Promise((resolve) => {
|
|
// make column-switching more responsive by delaying this load
|
|
scheduleIdleTask(() => resolve(timeline))
|
|
})
|
|
})
|
|
})
|
|
}
|
|
</script> |