code cleanup
This commit is contained in:
parent
3f5f016c32
commit
62d7166b39
|
@ -1,4 +1,5 @@
|
|||
{{#if props}}
|
||||
{{#await asyncProps}}
|
||||
{{then props}}
|
||||
<PseudoVirtualListItem :component
|
||||
:props
|
||||
:key
|
||||
|
@ -10,20 +11,15 @@
|
|||
:height
|
||||
on:scrollToPosition
|
||||
/>
|
||||
{{/if}}
|
||||
{{/await}}
|
||||
<script>
|
||||
import PseudoVirtualListItem from './PseudoVirtualListItem.html'
|
||||
export default {
|
||||
async oncreate() {
|
||||
let makeProps = this.get('makeProps')
|
||||
let key = this.get('key')
|
||||
if (makeProps) {
|
||||
let props = await makeProps(key)
|
||||
this.set({props: props})
|
||||
}
|
||||
},
|
||||
components: {
|
||||
PseudoVirtualListItem
|
||||
},
|
||||
computed: {
|
||||
asyncProps: async (makeProps, key) => makeProps && makeProps(key)
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -187,6 +187,10 @@
|
|||
let instanceName = this.store.get('currentInstance')
|
||||
let timelineName = this.get('timeline')
|
||||
let handleItemIdsToAdd = () => {
|
||||
let itemIdsToAdd = this.get('itemIdsToAdd')
|
||||
if (!itemIdsToAdd || !itemIdsToAdd.length) {
|
||||
return
|
||||
}
|
||||
mark('handleItemIdsToAdd')
|
||||
let scrollTop = this.get('scrollTop')
|
||||
let shouldShowHeader = this.store.get('shouldShowHeader')
|
||||
|
|
|
@ -1,24 +1,20 @@
|
|||
{{#if props}}
|
||||
<VirtualListItem :component
|
||||
{{#await asyncProps}}
|
||||
{{then props}}
|
||||
<VirtualListItem :component
|
||||
:offset
|
||||
:props
|
||||
:key
|
||||
:index
|
||||
/>
|
||||
{{/if}}
|
||||
{{/await}}
|
||||
<script>
|
||||
import VirtualListItem from './VirtualListItem'
|
||||
export default {
|
||||
async oncreate() {
|
||||
let makeProps = this.get('makeProps')
|
||||
let key = this.get('key')
|
||||
if (makeProps) {
|
||||
let props = await makeProps(key)
|
||||
this.set({props: props})
|
||||
}
|
||||
},
|
||||
components: {
|
||||
VirtualListItem
|
||||
},
|
||||
computed: {
|
||||
asyncProps: async (makeProps, key) => makeProps && makeProps(key)
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -3,11 +3,13 @@
|
|||
// for a good breakdown of the concepts behind this.
|
||||
|
||||
import Queue from 'tiny-queue'
|
||||
import { mark, stop } from './marks'
|
||||
|
||||
const taskQueue = new Queue()
|
||||
let runningRequestIdleCallback = false
|
||||
|
||||
function runTasks (deadline) {
|
||||
mark('scheduleIdleTask:runTasks()')
|
||||
while (taskQueue.length && deadline.timeRemaining() > 0) {
|
||||
taskQueue.shift()()
|
||||
}
|
||||
|
@ -16,6 +18,7 @@ function runTasks (deadline) {
|
|||
} else {
|
||||
runningRequestIdleCallback = false
|
||||
}
|
||||
stop('scheduleIdleTask:runTasks()')
|
||||
}
|
||||
|
||||
export function scheduleIdleTask (task) {
|
||||
|
|
Loading…
Reference in New Issue