summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lazy_loader.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/lazy_loader.js')
-rw-r--r--app/assets/javascripts/lazy_loader.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/assets/javascripts/lazy_loader.js b/app/assets/javascripts/lazy_loader.js
index 9e8edd05b88..a464290ffb5 100644
--- a/app/assets/javascripts/lazy_loader.js
+++ b/app/assets/javascripts/lazy_loader.js
@@ -1,4 +1,4 @@
-import _ from 'underscore';
+import { debounce, throttle } from 'lodash';
export const placeholderImage =
'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
@@ -82,7 +82,7 @@ export default class LazyLoader {
}
startIntersectionObserver = () => {
- this.throttledElementsInView = _.throttle(() => this.checkElementsInView(), 300);
+ this.throttledElementsInView = throttle(() => this.checkElementsInView(), 300);
this.intersectionObserver = new IntersectionObserver(this.onIntersection, {
rootMargin: `${SCROLL_THRESHOLD}px 0px`,
thresholds: 0.1,
@@ -102,8 +102,8 @@ export default class LazyLoader {
};
startLegacyObserver() {
- this.throttledScrollCheck = _.throttle(() => this.scrollCheck(), 300);
- this.debouncedElementsInView = _.debounce(() => this.checkElementsInView(), 300);
+ this.throttledScrollCheck = throttle(() => this.scrollCheck(), 300);
+ this.debouncedElementsInView = debounce(() => this.checkElementsInView(), 300);
window.addEventListener('scroll', this.throttledScrollCheck);
window.addEventListener('resize', this.debouncedElementsInView);
}