blob: 0dd8db6c99d944c8e10625c75049c94a36399d4d [file] [log] [blame]
Adrià Vilanova Martínez43c75202024-10-19 15:55:15 +02001import { NodeMutation } from '../../../presentation/nodeWatcher/NodeWatcherHandler';
Adrià Vilanova Martínez7c941c72024-10-26 20:23:34 +02002import 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}