forked from cybrespace/pinafore
don't use rIC while scrolling (#455)
* don't use rIC while scrolling * remove unnecessary import
This commit is contained in:
parent
c4c70dfd89
commit
6ad20e72a7
|
@ -4,8 +4,6 @@
|
||||||
import throttle from 'lodash-es/throttle'
|
import throttle from 'lodash-es/throttle'
|
||||||
import { isFullscreen, attachFullscreenListener, detachFullscreenListener } from '../../_utils/fullscreen'
|
import { isFullscreen, attachFullscreenListener, detachFullscreenListener } from '../../_utils/fullscreen'
|
||||||
import { mark, stop } from '../../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
|
||||||
import { isMobile } from '../../_utils/isMobile'
|
|
||||||
import { doubleRAF } from '../../_utils/doubleRAF'
|
import { doubleRAF } from '../../_utils/doubleRAF'
|
||||||
import { observe } from 'svelte-extras'
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
|
@ -95,12 +93,7 @@
|
||||||
onScroll (event) {
|
onScroll (event) {
|
||||||
let { scrollTop, scrollHeight } = event.target
|
let { scrollTop, scrollHeight } = event.target
|
||||||
|
|
||||||
// On mobile devices, this can make scrolling more responsive. On
|
doubleRAF(() => {
|
||||||
// desktop browsers... it's probably overkill, and can lead to a
|
|
||||||
// checkerboarding issue ("I just scrolled, why is it blank for 5 seconds?").
|
|
||||||
let runTask = isMobile() ? scheduleIdleTask : requestAnimationFrame
|
|
||||||
|
|
||||||
runTask(() => {
|
|
||||||
mark('onScroll -> setForRealm()')
|
mark('onScroll -> setForRealm()')
|
||||||
this.store.setForRealm({scrollTop, scrollHeight})
|
this.store.setForRealm({scrollTop, scrollHeight})
|
||||||
stop('onScroll -> setForRealm()')
|
stop('onScroll -> setForRealm()')
|
||||||
|
|
Loading…
Reference in New Issue