blob: 5c2d30824705822798039a4c4ebd241c4fb8c9fa [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 CCInfiniteScrollLoadMoreBarHandler extends CssSelectorNodeWatcherScriptHandler<InfiniteScrollNodeWatcherOptions> {
6 cssSelector = '.load-more-bar';
7
8 onMutatedNode({ node }: NodeMutation) {
Adrià Vilanova Martínezd45c04e2024-06-02 19:13:38 +02009 if (!(node instanceof Element)) {
10 console.error(
11 '[CCInfiniteScrollLoadMoreBarHandler] Node is not an Element: ',
12 node,
13 );
14 return;
15 }
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020016 this.options.ccInfiniteScroll.observeLoadMoreBar(node);
17 }
18}