blob: c776588dd55bf9951a8ab75a647fabf46598c9c9 [file] [log] [blame]
Adrià Vilanova Martínezfe694782024-11-09 20:40:43 +01001import { NodeMutation } from '../../../../presentation/nodeWatcher/NodeWatcherHandler';
2import CCInfiniteScroll from '../../core/ccInfiniteScroll';
3import CssSelectorNodeWatcherHandler from '../../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter';
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02004
Adrià Vilanova Martínez7c941c72024-10-26 20:23:34 +02005export default class CCInfiniteScrollLoadMoreBarHandler extends CssSelectorNodeWatcherHandler {
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02006 cssSelector = '.load-more-bar';
7
Adrià Vilanova Martínez7c941c72024-10-26 20:23:34 +02008 constructor(private ccInfiniteScroll: CCInfiniteScroll) {
9 super();
10 }
11
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020012 onMutatedNode({ node }: NodeMutation) {
Adrià Vilanova Martínezd45c04e2024-06-02 19:13:38 +020013 if (!(node instanceof Element)) {
14 console.error(
15 '[CCInfiniteScrollLoadMoreBarHandler] Node is not an Element: ',
16 node,
17 );
18 return;
19 }
Adrià Vilanova Martínez7c941c72024-10-26 20:23:34 +020020 this.ccInfiniteScroll.observeLoadMoreBar(node);
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020021 }
22}