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