blob: b36e0b9267318a4dc90180fa8fab738ed004fa68 [file] [log] [blame]
Adrià Vilanova Martínez43c75202024-10-19 15:55:15 +02001import { NodeMutation } from '../../../presentation/nodeWatcher/NodeWatcherHandler';
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02002import CssSelectorNodeWatcherScriptHandler from '../../../common/architecture/scripts/nodeWatcher/handlers/CssSelectorNodeWatcherScriptHandler';
3import { InfiniteScrollNodeWatcherOptions } from '../scripts/ccInfiniteScroll.script';
4
5export default class CCInfiniteScrollSetUpHandler extends CssSelectorNodeWatcherScriptHandler<InfiniteScrollNodeWatcherOptions> {
6 cssSelector = 'ec-app, .scrollable-content';
7
8 onMutatedNode({ node }: NodeMutation) {
9 if (!(node instanceof Element)) return;
10 const isScrollableContent = node.classList.contains('scrollable-content');
11 this.options.ccInfiniteScroll.setUpIntersectionObserver(
12 node,
13 isScrollableContent,
14 );
15 }
16}