Adrià Vilanova Martínez | fe69478 | 2024-11-09 20:40:43 +0100 | [diff] [blame] | 1 | import { NodeMutation } from '../../../../presentation/nodeWatcher/NodeWatcherHandler'; |
| 2 | import CCInfiniteScroll from '../../core/ccInfiniteScroll'; |
| 3 | import CssSelectorNodeWatcherHandler from '../../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter'; |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 4 | |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 5 | export default class CCInfiniteScrollLoadMoreBarHandler extends CssSelectorNodeWatcherHandler { |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 6 | cssSelector = '.load-more-bar'; |
| 7 | |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 8 | constructor(private ccInfiniteScroll: CCInfiniteScroll) { |
| 9 | super(); |
| 10 | } |
| 11 | |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 12 | onMutatedNode({ node }: NodeMutation) { |
Adrià Vilanova Martínez | d45c04e | 2024-06-02 19:13:38 +0200 | [diff] [blame] | 13 | if (!(node instanceof Element)) { |
| 14 | console.error( |
| 15 | '[CCInfiniteScrollLoadMoreBarHandler] Node is not an Element: ', |
| 16 | node, |
| 17 | ); |
| 18 | return; |
| 19 | } |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 20 | this.ccInfiniteScroll.observeLoadMoreBar(node); |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 21 | } |
| 22 | } |