Permalink
Browse files

avoid requestIdleCallback for realtime things to make interface more …

…responsive
  • Loading branch information...
mmckegg committed Oct 11, 2018
1 parent 59b4e2d commit d9386222e16e2fcd7d8f86106d63560acf016f0d
View
@@ -44,7 +44,7 @@ function Scroller (scroller, content, render, opts) {
entries.forEach(entry => {
if (entry.isIntersecting) {
visibleObserver.unobserve(entry.target)
onceIdle(() => opts.onItemVisible && opts.onItemVisible(entry.target))
process.nextTick(() => opts.onItemVisible && opts.onItemVisible(entry.target))
}
})
}, {
@@ -98,7 +98,7 @@ function Scroller (scroller, content, render, opts) {
pull.drain(function (msg) {
toRenderCount.set(toRenderCount() + 1)
onceIdle(() => {
process.nextTick(() => {
// render post when idle
var element = render(msg)
queueAppend(element)
View
@@ -87,8 +87,7 @@ exports.create = function (api) {
var collection = Value([])
subscribe(id)
// try not to saturate the thread
onceIdle(() => {
process.nextTick(() => {
pull(
api.sbot.pull.backlinks({
query: [ { $filter: { dest: id } } ],
@@ -111,7 +111,7 @@ exports.create = function (api) {
})
}
result.sync = computed([backlinks.sync, sync], (a, b) => a && b, { idle: true })
result.sync = computed([backlinks.sync, sync], (a, b) => a && b, { nextTick: true })
return result
}
@@ -38,7 +38,7 @@ exports.create = function (api) {
}, [
h('span.name', '#' + channel)
])
}, { maxTime: 5, idle: true })
}, { maxTime: 5, nextTick: true })
])
])
})
@@ -315,7 +315,7 @@ exports.create = function (api) {
])
}, {
maxTime: 5,
idle: true
nextTick: true
}),
when(moreCount,
h('a.profile -more', {
@@ -97,7 +97,7 @@ exports.create = function (api) {
api.contact.html.followToggle(id, { block: false })
])
])
}, { idle: true, maxTime: 10 })
}, { nextTime: true, maxTime: 10 })
])
]
}
@@ -65,7 +65,7 @@ exports.create = function (api) {
api.contact.html.followToggle(id, { block: false })
])
])
}, { idle: true, maxTime: 2 })
}, { nextTime: true, maxTime: 2 })
])
]
}
@@ -55,7 +55,7 @@ exports.create = function (api) {
h('a.ToggleButton', { 'ev-click': () => select(id) }, i18n('View Taggers'))
])
])
}, { idle: true, maxTime: 2 })
}, { nextTick: true, maxTime: 2 })
])
]
}

0 comments on commit d938622

Please sign in to comment.